getImageFileFromAssets static method
Implementation
static Future<File> getImageFileFromAssets(ByteData byteData,
{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(byteData.buffer
.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
return file;
}