ContentType class - dart:io library (original) (raw)

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

A ContentType is immutable.

Implemented types

Constructors

ContentType(String primaryType, String subType, {String? charset, Map<String, String?> parameters = const {}})

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 andparameters 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 charsetor in parameters, will have its value converted to lower-case.

factory

Properties

charsetString?

Gets the character set, if any.

no setter

hashCodeint

The hash code for this object.

no setterinherited

mimeTypeString

Gets the MIME type and subtype, without any parameters.

no setter

parametersMap<String, String?>

A map of parameters.

no setterinherited

primaryTypeString

Gets the primary type.

no setter

runtimeTypeType

A representation of the runtime type of the object.

no setterinherited

subTypeString

Gets the subtype.

no setter

valueString

The value of the header.

no setterinherited

Methods

noSuchMethod(Invocation invocation)→ dynamic

Invoked when a nonexistent method or property is accessed.

inherited

toString()→ String

A string representation of this object.

inherited

Operators

operator ==(Object other)→ bool

The equality operator.

inherited

Static Properties

binaryContentType

Content type for binary data.

final

htmlContentType

Content type for HTML using UTF-8 encoding.

final

jsonContentType

Content type for JSON using UTF-8 encoding.

final

textContentType

Content type for plain text using UTF-8 encoding.

final

Static Methods

parse(String value)→ ContentType

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

override