yield if not null
This is not a new idea (https://github.com/dart-lang/language/issues/2307). But in the light of the latest feature with the "?" prefix:
{ 'name': ?hello }
[ ?hello ]
Why:
yield ?hello;
Or even:
return ?hello;
Does not exist?
yield ?expr; could make sense. It's an operation that can be omitted, so doing nothing if the value is null is valid.
return ?expr; probably won't work. If it just returns without a value if expr is null, that's exactly the same as return expr;.
If it doesn't return at all, that'll be very confusion.
There are several places where "do nothing if the value is null" makes sense.
It would be nice to have a coherent feature, rather than adding each of these piecemeal.
I searched on GitHub (the results are very limited) and found a few places where yield ?expr; can fit: util.dart#L43, ast.dart#L28 and core.dart#L48.