DataPart class final

A data part containing binary data (e.g., images).

Inheritance
Annotations

Constructors

DataPart(Uint8List bytes, {required String mimeType, String? name})
Creates a new data part.
DataPart.fromJson(Map<String, Object?> json)
Creates a data part from a JSON-compatible map.
factory

Properties

bytes → Uint8List
The binary data.
final
hashCode → int
The hash code for this object.
no setteroverride
mimeType → String
The MIME type of the data.
final
name → String?
Optional name for the data.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
Serializes the part to a JSON map.
override
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

extensionFromMimeType(String mimeType) → String?
Gets the extension for a MIME type.
fromFile(XFile file) → Future<DataPart>
Creates a data part from an XFile.
mimeTypeForFile(String path, {Uint8List? headerBytes}) → String
Gets the MIME type for a file.
nameFromMimeType(String mimeType) → String
Gets the name for a MIME type.

Constants

defaultMimeType → const String
type → const String