late defers the first assignment of a non-nullable variable. Reading it before assignment throws at runtime.

Program

Play the program to assign a late greeting before reading it.

late_init.dart
void main() {
  late String greeting;
  greeting = 'Hello, Ada!';
  print(greeting);
}
late Promise to assign before reading.
non-nullable Lets a non-nullable be declared without an initial value.
runtime check Reading before assignment throws `LateInitializationError`.