writeImageToFile method
Writes the image bytes to a file at the given path. Returns a File object representing the written file. Throws an IOException if the file cannot be written.
You need check isMvimg before calling this method.
Implementation
File writeImageToFile(String path) {
final file = File(path);
file.writeAsBytesSync(getImageBytes());
return file;
}