Description
Right now the dart analyser when faced with this:
final String? someValue;
...
String newValue = someValue == null ? 'test' : someValue;
Will error with nullability because it will tell you that you need to assert that someValue is not null right before the ;. It's obviously not null and any trinary operator case like this should automatically be handled and known.
Second case:
Consider the following function definition:
final bool Function()? someFunction;
In every other language with null safety that I could find I can execute it conditionally like this:
someFunction?() ?? someothervalue;
Dart doesn't allow that, but does allow it if the parent is null with the ?. operator. It should allow the ?() syntax as this gets rid of a TON of cases of having to use the trinary operator.
Third Case:
asert(someObject != null);
CallSomething(someObject.someProperty);
Because of the assert someObject is known from this point forward to be not null and shouldn't require the ! assertion.
Fourth:
There are numerous cases of If statements where a property must not be null as a result but in the body of the IF it won't know that it can't be null and require ! when it's not possible and you've already handled it.
Please consider correcting all of these cases so that we can stop using ! when it really isn't needed. Thanks!