You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dart SDK version: 2.11.0-213.5.beta (beta) (Thu Oct 29 11:45:16 2020 +0100) on "macos_x64"
The text was updated successfully, but these errors were encountered:
renatoathaydes
changed the title
Null safety feedback: [issue summary]
Null safety feedback: final field check for null does not convinces the compiler field is not null
Nov 6, 2020
renatoathaydes
changed the title
Null safety feedback: final field check for null does not convinces the compiler field is not null
Null safety feedback: final field check for null does not convince the compiler field is not null
Nov 6, 2020
Why even have final if the language does not enforce anything one would expect from final?
final means you can't write into it. And indeed you can't.
Remember Dart 1 was a very different language from Dart 2. It had type annotations that did not enforce anything - but existed to communicate intent. Some of the design decisions come from that era and unfortunately we will have to live with them for some time.
This fails to compile on line 18, but it should work because the field is final so the null check ensures the field can't be null.
DartPad Link.
Dart version:
The text was updated successfully, but these errors were encountered: