Future<Uint8List> consolidateStreamToBytes(Stream<List<int>> stream) async { final List<int> bytes = await stream.expand((x) => x).toList(); return Uint8List.fromList(bytes); }