cloud_media 0.0.1
cloud_media: ^0.0.1 copied to clipboard
A complete Firebase-native media management Flutter package.
Changelog #
All notable changes to CloudMedia will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.0.1 - 2026-06-05 #
Added #
Core API
CloudMedia.pick()— pick images, videos, audio, PDFs in one lineCloudMedia.list()— fetch all media for authenticated user with filteringCloudMedia.watch()— real-time stream of media lifecycle (pending → syncing → synced)CloudMedia.delete()/CloudMedia.deleteRef()— soft delete by ID or referenceCloudMedia.restore()— restore soft-deleted mediaCloudMedia.download()— download media to local device storageCloudMedia.share()— share via platform share sheetCloudMedia.get()— fetch single media item by IDCloudMedia.sync()— force flush offline queueCloudMedia.getPendingCount()— count of queued operationsCloudMedia.clearCache()— clear all local cacheCloudMedia.initialize()— configure and boot the package
Media Support
- Image picking — JPG, JPEG, PNG, WebP (max 10MB)
- Video picking — MP4, MOV (max 100MB, pass-through upload)
- Audio picking — MP3, AAC, M4A (max 50MB)
- PDF picking (max 25MB)
- Multi-select support (default 20, max 100 files)
Processing
- Automatic image compression to WebP at 85% quality (40–80% size reduction)
- On-device thumbnail generation — 200×200 WebP at quality 80
- Background removal screen with 30-second timeout, retry, and use-original fallback
- Pluggable
BackgroundRemovalProvidercontract for custom ML providers
Offline Sync
- Queue-based offline-first architecture via
riverpod_offline_sync - Auto-sync on reconnect
- Exponential backoff retry (max 5 retries)
CloudMediaOfflineAdapterisolates all queue interactions- Upload, metadata create, thumbnail upload, and delete operations queued separately
- Idempotency keys prevent duplicate operations
Cache
- Three-layer cache — memory, disk (Hive), Firebase source
- LRU eviction policy
- 500MB default disk cache limit (configurable)
- 30-day TTL with automatic expiry cleanup
- Cache invalidated on delete
UI Widgets
CloudImage— local + remote image display, zoom, Hero animation supportCloudVideo— video player with controls, local + remote playbackCloudAudio— audio player with seek bar and duration displayCloudFile— file tile with download and share actionsMediaGrid— 3-column grid with upload overlay and video badgeUploadProgress— linear progress bar with percentage and byte displayUploadProgressIndicator— progress with pause, resume, cancel controlsSyncStatusIndicator— shows sync state and pending count badgePermissionAwareMediaPicker— wraps any widget with automatic permission flow
Screens
MediaPickerScreen— orchestrates permissions + picking flowReviewScreen— swipeable page view before upload confirmationMediaLibraryScreen— full browsable media library with refreshEditorScreen— placeholder for crop, rotate, brightness (stub)BackgroundRemovalScreen— full implementation with timeout + retry UI
Dialogs
ErrorDialog— with retry and dismiss actionsLoadingDialog— with optional progress percentageConfirmationDialog— with customizable confirm colorCroppingDialog— stub returning original (ready forimage_cropperintegration)
Services
FirebaseService— Firestore + Storage operations withFirebaseAuthintegrationUploadService— file picking, validation, progress streamingCacheService— Hive-backed LRU disk cacheCompressionService— WebP compression viaflutter_image_compressThumbnailService— on-device thumbnail generation viaimagepackageOfflineSyncService— wrapsriverpod_offline_syncwith operation handlersStorageQueueService— pause/resume/cancel individual uploadsPermissionService— typed permission requests viapermission_handler_package
State Management
cloudMediaProvider— core provider orchestrating all servicesmediaListProvider— Riverpod family provider for media listsmediaStreamProvider— real-time stream provider for single itemuploadProvider— upload progress stream managementsyncStateProvider— global sync state (idle / syncing / error)pendingMediaCountProvider— pending queue countisMediaSyncingProvider— boolean sync statesyncStatusTextProvider— human-readable sync status stringconnectivityStatusProvider— network connectivity state
Error Handling
CloudMediaPermissionDeniedExceptionCloudMediaPermissionPermanentlyDeniedExceptionCloudMediaUnsupportedFileTypeExceptionCloudMediaFileTooLargeExceptionCloudMediaUploadFailedExceptionCloudMediaOfflineQueueExceptionCloudMediaSyncExceptionCloudMediaNetworkExceptionCloudMediaCompressionExceptionCloudMediaThumbnailGenerationExceptionCloudMediaBackgroundRemovalTimeoutExceptionCloudMediaSelectionLimitExceededExceptionCloudMediaNotFoundException
Utilities
CloudLogger— debug/info/warning/error logging with enable/disable flagErrorHandler— translates Firebase exceptions into typed CloudMedia exceptionsFileUtils— extension, mime type, size formatting, delete helpersValidators— file type, size, and selection count validationDateFormatter— relative time, date, duration formattingPlatformUtils— platform detection helpersFirestorePaths— centralized Firestore path constantsFileConstants— file size limits, extensions, cache settingsErrorMessages— centralized error message stringsUIConstants— spacing, border radius, animation durations
Configuration (CloudMediaConfig)
maxCacheSizeMb— default 500imageQuality— default 85 (range 1–100)thumbnailSize— default 200pxmaxSelection— default 20 (hard max 100)enableOfflineSync— default trueenableReviewScreen— default trueenableBackgroundRemoval— default truecompressAutomatically— default trueautoGenerateThumbnails— default trueuploadTimeout— default 5 minutesmaxRetries— default 3enableLogging— default falsecustomStorageBucket— optional custom Firebase Storage bucket
Dependencies #
| Package | Version |
|---|---|
| firebase_core | ^4.10.0 |
| firebase_auth | ^6.5.2 |
| firebase_storage | ^13.4.2 |
| cloud_firestore | ^6.5.0 |
| image_picker | ^1.1.2 |
| file_picker | ^12.0.0-beta.5 |
| video_player | ^2.9.2 |
| audioplayers | ^6.1.0 |
| flutter_riverpod | ^3.3.2-dev.2 |
| riverpod_offline_sync | ^1.0.3 |
| permission_handler_package | ^1.0.5 |
| flutter_image_compress | ^2.3.0 |
| image | ^4.2.0 |
| hive_flutter | ^1.1.0 |
| photo_view | ^0.15.0 |
| cached_network_image | ^3.4.1 |
| share_plus | ^13.1.0 |
| connectivity_plus | ^7.1.1 |
| path_provider | ^2.1.4 |
| flutter_screenutil | ^5.9.3 |
| uuid | ^4.5.1 |
| mime | ^2.0.0 |
| intl | ^0.20.2 |
Supported Platforms #
| Platform | Status |
|---|---|
| Android | ✅ Fully supported |
| iOS | ✅ Fully supported |
| macOS | ✅ Supported |
| Windows | ✅ Supported |
| Linux | ✅ Supported |
| Web | ⚠️ Partial — dart:io used throughout, Web requires platform abstraction layer |
Known Limitations #
- Video compression — pass-through only; transcoding not implemented in v1
- Video thumbnails — not implemented; requires
video_thumbnailpackage - Cropping dialog — stub; returns original file; requires
image_cropperintegration - Background removal — UI and timeout fully implemented;
LocalBackgroundRemovalProvideris a stub returning the original image; plug inremove_bg, ML Kit, orrembgfor real removal - Web platform —
dart:io(File,Directory) used in services; Web requires conditional imports and browser file API abstractions - Editor screen — stub; crop, rotate, brightness not yet implemented
For questions or issues visit the GitHub repository.