m3uzz / date_time_picker

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.
https://pub.dartlang.org/packages/date_time_picker
Other
105 stars 158 forks source link

What‘s type of "late"? #32

Open wyz2016 opened 3 years ago

wyz2016 commented 3 years ago

捕获

hslbetto commented 3 years ago

With nullsafety, by default dart interpret that all variables should be not null, so, you always need to set the initial value. However, if you want a nullable variable, you need to tell dart using ? like (int? varName) that this specific variable is nullable. Now, LATE is a way to tell dart that this variable is not nullable, but the initial value will be set in another point of the code before you using it. In other words, this is a compromise that you will set the initial value before using it.