storeImage function
stores the imgBytes
as an image given by the name
, returns the new File
Implementation
Future<File?> storeImage(Uint8List imgBytes, String name) async {
// Write the file
try {
var file = await localFile(name);
// if (kIsWeb) {
//TODO: support storing images/file in indexedDb or something for web
// } else
file = await file.writeAsBytes(imgBytes); //u good?
return file;
} catch (e) {
debugPrint("!!! failed to store image: " + e.toString());
return null;
}
}