CloudMediaItem class

Represents a single media item managed by CloudMedia.

Returned by CloudMedia.pick, CloudMedia.list, and CloudMedia.get.

A media item starts with status = CloudMediaStatus.pending and transitions to CloudMediaStatus.synced once uploaded to Firebase. The localPath is available immediately; downloadUrl is populated after the upload completes.

Constructors

CloudMediaItem({required String id, required String userId, required CloudMediaType type, required String fileName, required String mimeType, required int size, int? width, int? height, double? duration, required String storagePath, required String downloadUrl, required String thumbnailUrl, required CloudMediaStatus status, Map<String, dynamic> metadata = const {}, required DateTime createdAt, DateTime? syncedAt, DateTime? deletedAt, String? localPath})
Creates a CloudMediaItem.
const
CloudMediaItem.fromFirestore(DocumentSnapshot<Object?> doc)
Creates a CloudMediaItem from a Firestore document snapshot.
factory

Properties

createdAt DateTime
When this item was created on the device.
final
deletedAt DateTime?
When this item was soft-deleted. Null if not deleted.
final
downloadUrl String
Firebase Storage download URL. Empty until status is CloudMediaStatus.synced.
final
duration double?
Audio or video duration in seconds, if available.
final
fileName String
The original file name including extension.
final
hashCode int
The hash code for this object.
no setterinherited
height int?
Image or video height in pixels, if available.
final
id String
Unique identifier for this media item (UUID).
final
localPath String?
Local file path on the device. Available immediately after picking, before the upload completes.
final
metadata Map<String, dynamic>
Additional metadata stored alongside this item in Firestore.
final
mimeType String
The MIME type of the file (e.g. image/webp, video/mp4).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
File size in bytes.
final
status CloudMediaStatus
Current sync status of this media item.
final
storagePath String
Firebase Storage path where the file is stored.
final
syncedAt DateTime?
When this item was successfully synced to Firebase. Null if not yet synced.
final
thumbnailUrl String
Firebase Storage URL for the generated thumbnail.
final
type CloudMediaType
The type of media (image, video, audio, or file).
final
userId String
The Firebase Auth UID of the user who owns this item.
final
width int?
Image or video width in pixels, if available.
final

Methods

copyWith({String? id, String? userId, CloudMediaType? type, String? fileName, String? mimeType, int? size, int? width, int? height, double? duration, String? storagePath, String? downloadUrl, String? thumbnailUrl, CloudMediaStatus? status, Map<String, dynamic>? metadata, DateTime? createdAt, DateTime? syncedAt, DateTime? deletedAt, String? localPath}) CloudMediaItem
Creates a copy of this item with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toFirestore() Map<String, dynamic>
Serializes this item to a Firestore-compatible map.
toString() String
A string representation of this object.
inherited

Operators

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