saveVideo static method

Future<bool?> saveVideo(
  1. String path, {
  2. String? albumName,
  3. bool toDcim = false,
  4. Map<String, String>? headers,
})

saves video from provided temp path and optional album name in gallery

Implementation

static Future<bool?> saveVideo(
  String path, {
  String? albumName,
  bool toDcim = false,
  Map<String, String>? headers,
}) async {
  File? tempFile;
  if (path.isEmpty) {
    throw ArgumentError(pleaseProvidePath);
  }
  if (!isVideo(path)) {
    throw ArgumentError(fileIsNotVideo);
  }
  if (!isLocalFilePath(path)) {
    tempFile = await _downloadFile(path, headers: headers);
    path = tempFile.path;
  }
  bool? result = await _channel.invokeMethod(
    methodSaveVideo,
    <String, dynamic>{'path': path, 'albumName': albumName, 'toDcim': toDcim},
  );
  if (tempFile != null) {
    tempFile.delete();
  }
  return result;
}