ContentType class
Representation of a content type. An instance of 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
andparameters
. If charset is passed andparameters
contains charset as well the passedcharset
will override the value in parameters. Keys passed in parameters will be converted to lower case. Thecharset
entry, whether passed ascharset
or inparameters
, will have its value converted to lower-case.factory
Properties
- charset → String
-
Gets the character set.
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- mimeType → String
-
Gets the mime-type, without any parameters.
read-only
-
parameters
→ Map<
String, String> -
Gets the map of parameters.
read-onlyinherited
- primaryType → String
-
Gets the primary type.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- subType → String
-
Gets the sub type.
read-only
- value → String
-
Gets the header value.
read-onlyinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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
- binary → ContentType
-
Content type for binary data.
final
- BINARY → ContentType
-
@Deprecated("Use binary instead")final
- html → ContentType
-
Content type for HTML using UTF-8 encoding.
final
- HTML → ContentType
-
@Deprecated("Use html instead")final
- json → ContentType
-
Content type for JSON using UTF-8 encoding.
final
- JSON → ContentType
-
@Deprecated("Use json instead")final
- text → ContentType
-
Content type for plain text using UTF-8 encoding.
final
- TEXT → ContentType
-
@Deprecated("Use text instead")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