getFile method

Future<File?> getFile({
  1. bool isOrigin = false,
  2. PMProgressHandler? progressHandler,
  3. int subtype = 0,
  4. PMDarwinAVFileType? darwinFileType,
  5. PMCancelToken? cancelToken,
})

Obtain the file of the asset.

  • isOrigin is used to obtain the origin file.
  • progressHandler is used to handle the progress of the file loading process.
  • subtype is used to obtain the file with subtype.
  • darwinFileType will try to define the export format when exporting assets, such as exporting a MOV file to MP4.
  • cancelToken is 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);
}