void main() {
Person()
..name = "John"
..age = 30
..sex = "Male"
..describeMyself();
}
class Person {
String? name;
int? age;
String? sex;
Person({this.name, this.age, this.sex});
void describeMyself() {
print('Hello my name is $name, I am $age years old');
}
}
// Dart Cascade notation: myObject..someMethod()
querySelector('#confirm')
..text = 'Confirm'
..classes.add('important')
..onClick.listen((e) => window.alert('Confirmed!'));
// can replace (you don’t need the button variable):
var button = querySelector('#confirm');
button.text = 'Confirm';
button.classes.add('important');
button.onClick.listen((e) => window.alert('Confirmed!'));