FilePart class final

A file attachment: an image, document, or audio clip.

Carries either a url (hosted/remote) or inline bytes. Document text extraction is deliberately out of scope here — that is a backend concern, to keep it off the UI thread.

Inheritance

Constructors

FilePart({required String mediaType, Uri? url, Uint8List? bytes, String? name})
Creates a file part. Provide a url, bytes, or both.
const
FilePart.fromJson(Map<String, Object?> json)
Reconstructs a FilePart from json.
factory

Properties

bytes Uint8List?
The inline contents of the file, if embedded.
final
hashCode int
The hash code for this object.
no setteroverride
mediaType String
The IANA media type, e.g. image/png or application/pdf.
final
name String?
A human-readable file name, if known.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url Uri?
The remote location of the file, if hosted.
final

Methods

copyWith({String? mediaType, Uri? url, Uint8List? bytes, String? name}) FilePart
Returns a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, Object?>
Serializes this part, including its type discriminator.
override
toString() String
A string representation of this object.
override

Operators

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