readAsString function Null safety

Future<String> readAsString(
  1. Stream<List<int>> stream,
  2. {Encoding? encoding}
)

Read stream into a String.

Defaults to utf8 if no encoding is given.

Implementation

Future<String> readAsString(Stream<List<int>> stream, {Encoding? encoding}) {
  encoding ??= utf8;
  return encoding.decodeStream(stream);
}