13. Optional types
Every variable
is object
Top level main()
function
Checked and
Production
modes
Syntactic sugar
Named
constructors
… and more
about.me/janamou
Streams Futures HTML
14. var x = 10;
var y = 20;
or
num x = 10;
num y = 20;
Optional types
about.me/janamou
16. class Person {
String firstName;
String lastName;
int age;
Person(this.firstName, this.lastName);
}
void main() {
Person person = new Person("Jana", "Moudrá");
}
Syntactic sugar
about.me/janamou
17. class Person {
String firstName;
String lastName;
int age;
Person(this.firstName, this.lastName);
Person.withAge(this.lastName, this.age);
}
void main() {
Person person = new Person.withAge("Moudrá", 25);
}
Named constructor
about.me/janamou
18. class Person {
String _firstName;
String _lastName;
int _age;
Person(this.firstName, this.lastName);
Person.withAge(this.lastName, this.age);
int get age => _age;
set age(int age) => _age = age;
}
Getter/Setter
about.me/janamou