📱 Flutter
Beginner
What is the late keyword in Dart?
Answer
The late keyword is a modifier for non-nullable variables that are initialized after their declaration, not at the point of declaration. It tells the Dart compiler "I promise this will be set before it is used — trust me." If you access a late variable before it is initialized, a LateInitializationError is thrown at runtime. It is commonly used for controllers in StatefulWidgets: late TextEditingController _controller; initialized in initState().