writeBytes function
Write bytes content. Does not fail
Implementation
Future<File> writeBytes(File file, Uint8List bytes) async {
try {
await file.writeAsBytes(bytes, flush: true);
} catch (_) {
await file.create(recursive: true);
await file.writeAsBytes(bytes, flush: true);
}
return file;
}