saveBytesToFile static method
Save the given bytes to a file at path.
Implementation
static Future<void> saveBytesToFile(Uint8List bytes, String path) async {
if (bytes.isEmpty) {
return;
}
final receivePort = ReceivePort();
final transferable = TransferableTypedData.fromList([bytes]);
await Isolate.spawn(_saveBytesIsolateEntry, [
receivePort.sendPort,
path,
transferable,
]);
final result = await receivePort.first;
receivePort.close();
if (result is Exception) {
throw result;
}
}