getImageFileFromUnit8list static method
Implementation
static Future<File> getImageFileFromUnit8list(Uint8List unit8list,
{String? name, String? dirName = 'localImgs'}) async {
// Store the picture in the temp directory.
// Find the temp directory using the `path_provider` plugin.
String path = (await getAppDirectory()).path + "$dirName/";
Directory _dir = Directory(path);
if (!_dir.existsSync()) _dir.createSync();
final file = File("${_dir.path}" + '${name ?? DateTime.now().millisecond}.jpg');
await file.writeAsBytes(unit8list);
return file;
}