ContentType abstract class
Representation of a content type. An instance of ContentType is immutable.
abstract class ContentType implements HeaderValue {
/**
* 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 and values passed in
* parameters will be converted to lower case.
*/
factory ContentType(String primaryType,
String subType,
{String charset, Map<String, String> parameters}) {
return new _ContentType(primaryType, subType, charset, parameters);
}
/**
* 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
*
* text/html; charset=utf-8
*
* will create a content type object with primary type [:text:], sub
* type [:html:] and parameter [:charset:] with value [:utf-8:].
*/
static ContentType parse(String value) {
return _ContentType.parse(value);
}
/**
* Gets the mime-type, without any parameters.
*/
String get mimeType;
/**
* Gets the primary type.
*/
String get primaryType;
/**
* Gets the sub type.
*/
String get subType;
/**
* Gets the character set.
*/
String get charset;
}
Implements
Static Methods
ContentType parse(String value) #
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
text/html; charset=utf-8
will create a content type object with primary type text, sub
type html and parameter charset with value utf-8.
static ContentType parse(String value) {
return _ContentType.parse(value);
}
Constructors
factory ContentType(String primaryType, String subType, {String charset, Map<String, String> parameters}) #
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 and values passed in parameters will be converted to lower case.
factory ContentType(String primaryType,
String subType,
{String charset, Map<String, String> parameters}) {
return new _ContentType(primaryType, subType, charset, parameters);
}
Properties
final Map<String, String> parameters #
Gets the map of parameters.
Map<String, String> get parameters;
Methods
abstract String toString() #
Returns the formatted string representation in the form:
value; parameter1=value1; parameter2=value2