Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

Cascade notation

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');
  }
}
 
PREVIOUS NEXT
Tagged: #Cascade #notation
ADD COMMENT
Topic
Name
2+3 =