decodeStream method
Decodes the Brotli-encoded data
to the corresponding string.
Use encoding
to specify the charset used by data
.
Implementation
Future<String> decodeStream(
Stream<List<int>> data, {
Encoding encoding = utf8,
}) {
return decoder
.bind(data)
.transform(encoding.decoder)
.fold<StringBuffer>(StringBuffer(), (b, string) => b..write(string))
.then((buffer) => buffer.toString());
}