InlineData class

Represents inline data used in requests or responses, including metadata like MIME type and the actual data, which is often encoded as a Base64 string. This class is useful for handling in-line binary data such as images, audio files, or any data that needs to be transmitted in the body of a message.

Parameters:

  • mimeType (optional String): The MIME type of the data (e.g., 'image/png', 'application/pdf').
  • data (optional String): The Base64-encoded data representing the binary content.

Usage: InlineData is commonly used when binary data needs to be transmitted in a format suitable for text-based protocols (e.g., JSON). It is especially useful for sending media or other non-text data in API requests or responses.

Constructors

InlineData({String? mimeType, String? data})
InlineData.fromJson(Map<String, dynamic> json)
Factory method to create an InlineData instance from a JSON map. This is used for deserializing JSON responses that contain inline data.
factory
InlineData.fromUint8List(Uint8List bytes)
Factory method to create an InlineData instance from raw bytes (Uint8List). The raw bytes are Base64-encoded, and the MIME type is inferred from the data using the mime package.
factory

Properties

data String?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
mimeType String?
getter/setter pair
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, dynamic>
Converts the InlineData instance into a JSON map. This method is useful for serializing the inline data to be sent in an API request or stored.
toString() String
A string representation of this object.
inherited

Operators

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