Lecture02-II - Introduction To Dart
Lecture02-II - Introduction To Dart
What is Dart?
Dart History
Dart Features
Flutter & Dart
Start Coding with Dart...
What is Dart?
Dart is a client-optimized programming language for apps on multiple
platforms.
Productive development
• Make changes iteratively: use hot reload to see the result instantly in your running
app
• Write code using a flexible type system with
rich static analysis and
powerful, configurable tooling
Dart can also be JIT (Just In Time) compiled for exceptionally fast
development cycles
Dart makes it easier to create smooth animations and transitions that run
at 60fps.
Dart SDK
Use the community-supported Dart SDK installer for Windows
DartPad
It is an online editor at https://dartpad.dartlang.org
Dart SDK
Hello World
Data Types
Dart is an optionally typed language
• Numbers
Int and double
• Strings
String is used to represent string literals.
• Booleans
Uses the bool keyword to represent a Boolean value.
• Lists
Ordered group of objects and it is synonymous to the concept of an array in other
programming languages. List
• Maps
set of values as key-value pairs. Map
• Dynamic
If the type of a variable is not explicitly specified, the variable’s type is dynamic.
Dart input output handling
Using Labels to Control the Flow
• A label can be used with break and continue to control the flow more
precisely.
• Line breaks are not allowed between the ‘continue’ or ‘break’ statement and
its label name. Also, there should not be any other statement in between a
label name and an associated loop.
Control flow statements
Collections - List
• Dart represents arrays in the form of List objects. A List is simply an ordered group of
objects.
• The dart:core library provides the List class
List
• The Map object is a simple key/value pair. Keys and values in a map may be
of any type. A Map is a dynamic collection.
Create
Class Object
example
Classes
Constructors
• Dart doesn't provide Access specifiers keywords like private, public and
protected.
• can use _ (underscore) at the start of the name to make a data member of a
class becomes private.
• So, a data member is either public (if not preceded by _) or private (if
preceded by _)
Dart Access Specifiers
a.dart
other.dart
Dart Access Specifiers
a.dart
other.dart
Class Inheritance- interface
Dart has no interface keyword.
Class Inheritance – Abstract class
Mixins
• A Mixin is a class that contains methods for use by other classes without
having to be the parent class of those other classes.