getFile method
Future<File?>
getFile({
- bool isOrigin = false,
- PMProgressHandler? progressHandler,
- int subtype = 0,
- PMDarwinAVFileType? darwinFileType,
- PMCancelToken? cancelToken,
Obtain the file of the asset.
isOriginis used to obtain the origin file.progressHandleris used to handle the progress of the file loading process.subtypeis used to obtain the file with subtype.darwinFileTypewill try to define the export format when exporting assets, such as exporting a MOV file to MP4.cancelTokenis used to cancel the file loading process.
Implementation
Future<File?> getFile({
bool isOrigin = false,
PMProgressHandler? progressHandler,
int subtype = 0,
PMDarwinAVFileType? darwinFileType,
PMCancelToken? cancelToken,
}) async {
assert(
_platformMatched,
'${Platform.operatingSystem} does not support obtain file.',
);
if (!_platformMatched) {
return null;
}
final String? path = await plugin.getFullFile(
id,
isOrigin: isOrigin,
progressHandler: progressHandler,
subtype: subtype,
darwinFileType: darwinFileType,
cancelToken: cancelToken,
);
if (path == null) {
return null;
}
return File(path);
}