save static method
Writes bytes to a unique file name and returns the saved file path.
Implementation
static Future<String> save(Uint8List bytes, String fileName) async {
if (Platform.isAndroid) {
try {
return await _saveIn(
Directory('/storage/emulated/0/Download'),
bytes,
fileName,
);
} on FileSystemException {
// Scoped storage can permit directory access but reject the file write.
// Retry the actual write in app storage, not just directory creation.
}
}
final directory = await _targetDirectory();
return _saveIn(directory, bytes, fileName);
}