CloudMediaConfig class
Configuration for the CloudMedia package.
Pass to CloudMedia.initialize to customize behavior:
await CloudMedia.initialize(
config: const CloudMediaConfig(
imageQuality: 85,
maxSelection: 20,
enableOfflineSync: true,
),
);
Constructors
- CloudMediaConfig({int maxCacheSizeMb = 500, int imageQuality = 85, int thumbnailSize = 200, int maxSelection = 20, bool enableOfflineSync = true, bool enableReviewScreen = true, bool enableBackgroundRemoval = true, Duration uploadTimeout = const Duration(minutes: 5), int maxRetries = 3, bool autoGenerateThumbnails = true, bool compressAutomatically = true, bool enableVideoCompression = false, int videoCompressionBitrate = 1000000, bool enableLogging = false, String? customStorageBucket})
-
Creates a CloudMediaConfig with the given settings.
const
Properties
- autoGenerateThumbnails → bool
-
Whether to automatically generate thumbnails after picking. Default: true.
final
- compressAutomatically → bool
-
Whether to automatically compress images to WebP after picking. Default: true.
final
- customStorageBucket → String?
-
Optional custom Firebase Storage bucket URL.
If null, uses the default Firebase Storage bucket.
final
- enableBackgroundRemoval → bool
-
Whether background removal is available in the pick flow. Default: true.
final
- enableLogging → bool
-
Whether to print debug logs. Default: false.
final
- enableOfflineSync → bool
-
Whether to enable offline-first sync via riverpod_offline_sync. Default: true.
final
- enableReviewScreen → bool
-
Whether to show a review screen after picking media. Default: true.
final
- enableVideoCompression → bool
-
Whether video compression is enabled. Default: false (pass-through).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageQuality → int
-
Image compression quality (1–100). Default: 85.
Images are compressed to WebP at this quality level.
final
- maxCacheSizeMb → int
-
Maximum disk cache size in megabytes. Default: 500.
final
- maxRetries → int
-
Maximum number of upload retries on failure. Default: 3.
final
- maxSelection → int
-
Maximum number of files the user can select at once. Default: 20.
Hard maximum is 100.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- thumbnailSize → int
-
Thumbnail size in pixels (width and height). Default: 200.
Image thumbnails are generated as JPEG on-device. Video thumbnails may be WebP.
final
- uploadTimeout → Duration
-
Timeout for individual upload operations. Default: 5 minutes.
final
- videoCompressionBitrate → int
-
Target bitrate for video compression in bits per second. Default: 1Mbps.
final
Methods
-
copyWith(
{int? maxCacheSizeMb, int? imageQuality, int? thumbnailSize, int? maxSelection, bool? enableOfflineSync, bool? enableReviewScreen, bool? enableBackgroundRemoval, Duration? uploadTimeout, int? maxRetries, bool? autoGenerateThumbnails, bool? compressAutomatically, bool? enableVideoCompression, int? videoCompressionBitrate, bool? enableLogging, String? customStorageBucket}) → CloudMediaConfig - Creates a copy of this config with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Serializes this config to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited