CloudMedia class

The primary public API for the CloudMedia package.

Initialize once in main() before using any other methods:

await CloudMedia.initialize(config: CloudMediaConfig());

Then use anywhere in your app:

final items = await CloudMedia.pick();
final all   = await CloudMedia.list();
CloudMedia.watch(items.first.id).listen((item) => print(item.status));
await CloudMedia.delete(items.first.id);
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clearCache() Future<void>
Clear all local disk and memory cache.
delete(String mediaId) Future<void>
Delete a media item by mediaId.
deleteRef(CloudMediaItem item) Future<void>
Delete a media item by its CloudMediaItem reference.
download(String mediaId) Future<String>
Download a media item to the device's local storage.
get(String mediaId) Future<CloudMediaItem>
Fetch a single media item by its mediaId.
getPendingCount() Future<int>
Returns the number of operations currently waiting in the offline queue.
initialize({CloudMediaConfig config = const CloudMediaConfig()}) Future<void>
Initialize CloudMedia with the given config.
list({CloudMediaType? type, int limit = 50, int offset = 0, DateTime? startDate, DateTime? endDate, String? searchQuery}) Future<List<CloudMediaItem>>
List all media uploaded by the current authenticated user.
pick({CloudMediaType type = CloudMediaType.image, int maxCount = 1, bool enableEditing = true, bool enableBackgroundRemoval = false}) Future<List<CloudMediaItem>>
Pick one or more media files from the device.
restore(String mediaId) Future<void>
Restore a soft-deleted media item.
share(String mediaId) Future<void>
Share a media item using the platform share sheet.
sync() Future<void>
Force-flush all pending operations in the offline sync queue.
watch(String mediaId) Stream<CloudMediaItem>
Watch real-time status updates for a media item.