decodeStream method
Decode a single value from stream.
This is equivalent to calling
type.decode(await stream.expand((bytes) => bytes).toList()), but may be
significantly more efficient as the binary blob does not need to be stored
in memory until all data is received.
Implementation
Future<T> decodeStream(Stream<List<int>> stream) =>
stream.transform(decoder).single;