FileAttachment class

File attachment in a message.

Constructors

FileAttachment({required String id, required String url, required String name, required String extension, required int size, String? mimeType, int? pageCount, String? thumbnailUrl, FileUploadStatus uploadStatus = FileUploadStatus.completed, double? uploadProgress, String? localPath, int? width, int? height, String? thumbhash, String? blurhash, Duration? duration, List<double>? waveform})
Creates a file attachment.
const
FileAttachment.fromJson(Map<String, dynamic> json)
Creates a FileAttachment from a JSON map (database storage format).
factory

Properties

blurhash String?
Blurhash placeholder for image.
final
duration Duration?
Duration (for audio/video).
final
extension String
File extension (pdf, jpg, etc.).
final
fileName String
File name (alias for name for API compatibility).
no setter
formattedSize String
Human-readable file size.
no setter
hashCode int
The hash code for this object.
no setterinherited
height int?
Height in pixels (for image/video).
final
id String
Unique identifier.
final
isAudio bool
Whether this is an audio file.
no setter
isImage bool
Whether this is an image file.
no setter
isPdf bool
Whether this is a PDF file.
no setter
isVideo bool
Whether this is a video file.
no setter
localPath String?
Local file path (if cached).
final
mimeType String?
MIME type of the file.
final
name String
Original file name.
final
pageCount int?
Number of pages (for PDFs).
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
File size in bytes.
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
thumbhash String?
Thumbhash placeholder for image.
final
thumbnailUrl String?
Thumbnail URL for preview.
final
uploadProgress double?
Upload progress (0.0 to 1.0).
final
uploadStatus FileUploadStatus
Current upload status.
final
url String
Remote URL of the file.
final
waveform List<double>?
Waveform data for audio visualization.
final
width int?
Width in pixels (for image/video).
final

Methods

copyWith({String? id, String? url, String? name, String? extension, int? size, String? mimeType, int? pageCount, String? thumbnailUrl, FileUploadStatus? uploadStatus, double? uploadProgress, String? localPath, int? width, int? height, String? thumbhash, String? blurhash, Duration? duration, List<double>? waveform}) FileAttachment
Creates a copy with updated fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this attachment to a JSON map for database storage.
toString() String
A string representation of this object.
inherited

Operators

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