saveImage static method
saves image from provided temp path and optional album name in gallery
Implementation
static Future<bool?> saveImage(
String path, {
String? albumName,
bool toDcim = false,
Map<String, String>? headers,
}) async {
File? tempFile;
if (path.isEmpty) {
throw ArgumentError(pleaseProvidePath);
}
if (!isImage(path)) {
throw ArgumentError(fileIsNotImage);
}
if (!isLocalFilePath(path)) {
tempFile = await _downloadFile(path, headers: headers);
path = tempFile.path;
}
bool? result = await _channel.invokeMethod(
methodSaveImage,
<String, dynamic>{'path': path, 'albumName': albumName, 'toDcim': toDcim},
);
if (tempFile != null) {
tempFile.delete();
}
return result;
}