Open lrhn opened 4 years ago
I think this should be part of one of Dart 3 milestones.
Most of the uses that I've touched are using the internal checkNotNullable
, which should make them easy to remove.
We may need to keep supporting non-null-safe code a little past the 3.0 release, for technical reasons, but removing unnecessary checks should be on the list for when we turn it off for good.
Ran into one of these today. I presume this is possible now?
Current null-safe platform libraries have seemingly redundant null-checks in many places.
A parameter of type
int
should only contain integers, but if the function is called from a non-null-safe library, it can get away with passingnull
values anyway. To improve the error message in that case, we have inserted test which check that the value is indeed notnull
(mostly usingArgumentError.checkNotNull
calls).When null safety becomes non-optional (when language versions before the introduction of null safety stops being supported), those extra checks should be removed again.
This issue should be kept open until this has happened.
Known positions should use
TODO(40614)
as a reminder, or usecheckNotNullable
fromdart:_internal
, which is easy to search for.