MediaType class

A class representing an HTTP media type, as used in Accept and Content-Type headers.

This is immutable; new instances can be created based on an old instance by calling change.

Constructors

MediaType(String type, String subtype, [Map<String, String>? parameters])
MediaType.parse(String mediaType)
Parses a media type.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
mimeType String
The media type's MIME type.
no setter
parameters Map<String, String>
The parameters to the media type.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtype String
The secondary identifier of the MIME type.
final
type String
The primary identifier of the MIME type.
final

Methods

change({String? type, String? subtype, String? mimeType, Map<String, String>? parameters, bool clearParameters = false}) MediaType
Returns a copy of this MediaType with some fields altered.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Converts the media type to a string.
override

Operators

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