I have the following form of assignment & null checks to avoid double lookups in my maps.
Is there a better or more idiomatic way to do this in Dart?
There are now 4 null aware operators
return subject ?? "defaultIfNull";
This is similar to ?? but sets the subject variable to a default if it is null.
subject ??= "defaultIfNull";
object?.x will return null if object is null, object.x would cause an exception if object were null
the result of the following
[
...[1, 2],
null,
]
is [1, 2, null]
to avoid the null value use ...?
var resultingList = [
...[1, 2],
...?subjectList,
];