saveVideo method

Future<AssetEntity> saveVideo(
  1. File inputFile, {
  2. required String? title,
  3. String? desc,
  4. String? relativePath,
  5. int? orientation,
  6. double? latitude,
  7. double? longitude,
  8. DateTime? creationDate,
})

Implementation

Future<AssetEntity> saveVideo(
  File inputFile, {
  required String? title,
  String? desc,
  String? relativePath,
  int? orientation,
  double? latitude,
  double? longitude,
  DateTime? creationDate,
}) async {
  _throwIfOrientationInvalid(orientation);
  if (!inputFile.existsSync()) {
    throw ArgumentError('The input file ${inputFile.path} does not exists.');
  }

  final filePath = inputFile.absolute.path;
  title = title?.trim();
  if (title == null || title.isEmpty) {
    title = path.basename(filePath);
  }

  final Map result = await _channel.invokeMethod(
    PMConstants.mSaveVideo,
    <String, dynamic>{
      'path': filePath,
      'title': title,
      'desc': desc ?? '',
      'relativePath': relativePath,
      'orientation': orientation,
      'latitude': latitude,
      'longitude': longitude,
      'creationDate': creationDate?.millisecondsSinceEpoch,
      ...onlyAddPermission,
    },
  );
  return ConvertUtils.convertMapToAsset(result.cast(), title: title);
}