saveLivePhoto method

Future<AssetEntity?> saveLivePhoto({
  1. required File imageFile,
  2. required File videoFile,
  3. required String? title,
  4. String? desc,
  5. String? relativePath,
})

Implementation

Future<AssetEntity?> saveLivePhoto({
  required File imageFile,
  required File videoFile,
  required String? title,
  String? desc,
  String? relativePath,
}) async {
  if (!imageFile.existsSync()) {
    assert(false, 'File of the image must exist.');
    return null;
  }
  if (!videoFile.existsSync()) {
    assert(false, 'videoFile must exists.');
    return null;
  }
  final Map<dynamic, dynamic>? result = await _channel.invokeMethod(
    PMConstants.mSaveLivePhoto,
    <String, dynamic>{
      'imagePath': imageFile.absolute.path,
      'videoPath': videoFile.absolute.path,
      'title': title,
      'desc': desc ?? '',
      'relativePath': relativePath,
      ...onlyAddPermission,
    },
  );
  if (result == null) {
    return null;
  }
  return ConvertUtils.convertMapToAsset(
    result.cast<String, dynamic>(),
    title: title,
  );
}