Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

What is late in Dart

/*
In Dart, we use the late keyword to declare variables that will be initialized later.
These are called non-nullable variables as they are initialized after the declaration.
Hence, we use the late keyword. Note: Once we declare 
a non-nullable late variable, the variable can't be null at runtime.

*/

class Person {
	late String name;
    late int age;
}

void main() {
    Person favPerson = Person();
    favPerson.name = "An Jorge";
  	favPerson.age = 33;

    print(favPerson.name);
  	print(favPerson.age);
}
 
PREVIOUS NEXT
Tagged: #What #late #Dart
ADD COMMENT
Topic
Name
5+6 =