cloudIdentifier property

Future<String?> get cloudIdentifier

The stable cloud identifier of the asset, shared across devices that use the same iCloud Photo Library.

Unlike AssetEntity.id (the localIdentifier), which differs on every device, the cloud identifier lets you match the same photo across devices.

Returns null when the asset has no cloud identifier, when iCloud Photos is disabled, or when the platform is below iOS 15 / macOS 12.

See also:

  • PhotoManager.plugin.getCloudIdentifiers to resolve many assets in one call, which is far more efficient than calling this getter in a loop.

Implementation

Future<String?> get cloudIdentifier async {
  final Map<String, String?> mapping = await plugin.getCloudIdentifiers(
    <String>[_asset.id],
  );
  return mapping[_asset.id];
}