MediaType class Null safety

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.
read-onlyinherited
mimeType String
The media type's MIME type.
read-only
parameters Map<String, String>
The parameters to the media type.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
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 non-existent 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