BodyType class
A body type that combines MIME type and encoding information.
This class encapsulates both the MIME type (what kind of content this is) and the optional encoding (how text content is encoded into bytes).
Examples:
// Text content with encoding
const textType = BodyType(
mimeType: MimeType.plainText,
encoding: utf8,
);
print(textType.toHeaderValue()); // "text/plain; charset=utf-8"
// Binary content without encoding
const binaryType = BodyType(mimeType: MimeType.octetStream);
print(binaryType.toHeaderValue()); // "application/octet-stream"
// JSON content
const jsonType = BodyType(
mimeType: MimeType.json,
encoding: utf8,
);
print(jsonType.toHeaderValue()); // "application/json; charset=utf-8"
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toHeaderValue(
) → String - Returns the value to use for the Content-Type header.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited