CloudMedia class
The primary public API for the CloudMedia package.
Initialize once in main() before using any other methods:
await CloudMedia.initialize(config: CloudMediaConfig());
- 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 Properties
- config → CloudMediaConfig
-
The active config. Available after initialize.
no setter
- provider → CloudMediaProvider
-
Internal accessor — used by Riverpod providers without creating a second instance.
no setter
Static Methods
-
cacheSize(
) → Future< int> - Returns total cache size in bytes.
-
clearCache(
) → Future< void> - Clear all local disk cache.
-
delete(
String mediaId) → Future< void> - Delete by media id. Queued if offline.
-
deleteRef(
CloudMediaItem item) → Future< void> - Delete from a CloudMediaItem reference.
-
download(
String mediaId) → Future< String> - Download to local storage. Checks cache first.
-
get(
String mediaId) → Future< CloudMediaItem> - Fetch a single media item by id.
-
getPendingCount(
) → Future< int> - Number of operations pending in the offline queue.
-
initialize(
{CloudMediaConfig config = const CloudMediaConfig()}) → Future< void> - Initialize CloudMedia. Call once in main() after Firebase.initializeApp().
-
list(
{CloudMediaType? type, int limit = 50, int offset = 0, DateTime? startDate, DateTime? endDate, String? searchQuery}) → Future< List< CloudMediaItem> > - List all media for the current user with optional filters.
-
pick(
{BuildContext? context, CloudMediaType type = CloudMediaType.image, int maxCount = 1, bool enableEditing = false, bool enableBackgroundRemoval = false, bool showPreview = false, String? folder, String? subFolder, CompressionProfile? compressionProfile}) → Future< List< CloudMediaItem> > - Pick one or more media files from the device.
-
restore(
String mediaId) → Future< void> - Restore a soft-deleted item.
- Share via platform share sheet.
-
showDeleteDialog(
BuildContext context, CloudMediaItem item) → Future< bool> - Show a confirmation dialog then delete if confirmed.
-
sync(
) → Future< void> - Force-flush the offline sync queue.
-
watch(
String mediaId) → Stream< CloudMediaItem> - Watch real-time status updates for a single media item.