dart / 2 / dart-io / contenttype-class.html

ContentType class

A MIME/IANA media type used as the value of the HttpHeaders.contentTypeHeader header.

A ContentType is immutable.

Implemented types

Constructors

ContentType(String primaryType, String subType, {String? charset, Map<String, String?> parameters = const {}})
factory
Creates a new content type object setting the primary type and sub type. The charset and additional parameters can also be set using charset and parameters. If charset is passed and parameters contains charset as well the passed charset will override the value in parameters. Keys passed in parameters will be converted to lower case. The charset entry, whether passed as charset or in parameters, will have its value converted to lower-case.

Properties

charset → String?
read-only
Gets the character set, if any.
hashCode → int
read-only, inherited
The hash code for this object.
mimeType → String
read-only
Gets the MIME type and subtype, without any parameters.
parameters → Map<String, String?>
read-only, inherited
A map of parameters.
primaryType → String
read-only
Gets the primary type.
runtimeType → Type
read-only, inherited
A representation of the runtime type of the object.
subType → String
read-only
Gets the subtype.
value → String
read-only, inherited
The value of the header.

Methods

noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed.
toString() → String
inherited
A string representation of this object.

Operators

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

Static Properties

binary → ContentType
final
Content type for binary data.
html → ContentType
final
Content type for HTML using UTF-8 encoding.
json → ContentType
final
Content type for JSON using UTF-8 encoding.
text → ContentType
final
Content type for plain text using UTF-8 encoding.

Static Methods

parse(String value) → ContentType
override
Creates a new content type object from parsing a Content-Type header value. As primary type, sub type and parameter names and values are not case sensitive all these values will be converted to lower case. Parsing this string

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-io/ContentType-class.html