copyAssetToGallery method

Future<AssetEntity?> copyAssetToGallery(
  1. AssetEntity asset,
  2. AssetPathEntity pathEntity
)

Implementation

Future<AssetEntity?> copyAssetToGallery(
  AssetEntity asset,
  AssetPathEntity pathEntity,
) async {
  if (pathEntity.isAll) {
    assert(
      pathEntity.isAll,
      "You can't copy the asset into the album containing all the pictures.",
    );
    return null;
  }
  final Map<dynamic, dynamic>? result = await _channel.invokeMethod(
    PMConstants.mCopyAsset,
    <String, dynamic>{'assetId': asset.id, 'galleryId': pathEntity.id},
  );
  if (result == null) {
    return null;
  }
  return ConvertUtils.convertMapToAsset(
    result.cast<String, dynamic>(),
    title: asset.title,
  );
}