Lesser known classes and functions from the Dart core libraries

Yeah @mraleph went into this in details in this talk

Basically instead of JsonDecoder, it gives you a decoder that goes Utf8 → Json directly without converting the Utf8 bytes into a string first

3 Likes

Thanks for the link, @Hari_07!

Another cool functionality from the Dart SDK that I didn’t know about until recently is the FutureRecord2 extension and its kin.

It lets you do parallel awaits more easily and readably than Future.wait() or [...].wait. Because it works on records. So:

var (text, image) = await (fetchText(), fetchImage()).wait;

Using record instead of iterable means that the types of text and image are correctly inferred, whatever they are.

10 Likes

Oh this is very cool. Thanks!

Flutter team can make a valuable video of the week with all those pearls.
How many cool stuffs to us are casual to them is beyond me!

2 Likes

Completer<T>.

Sooooo useful.

1 Like