Dart Getter Shorthand to Cache Computed Properties

An elegant Dart getter shorthand used to cache computed properties:

T get foo => _foo ??= _computeFoo();

// which depends on having
T _foo;
T _computeFoo() => /** ... **/;

It makes use of the fallback assignment operator ??=.

Check out Null-Aware Operators in Dart for a complete guide on dealing with nulls in Dart!