MimeType class

Represents a MIME Type, as originally defined in RFC 2046 and subsequently used in other Internet protocols including HTTP.

This class, however, does not contain support for the q-parameters used in HTTP content negotiation. Those can be found in the sub-class MediaType in the http folder.



MimeType(String type, {String subtype, String charset, Map<String, String> parameters})
  • Create a new Mimetype for the given primary type and subtype and charset and parameters.
  • Properties

    charset String
    read / write
    hashCode int
    The hash code for this object. [...]
    read-only, inherited
    parameters Map<String, String>
    read / write
    runtimeType Type
    A representation of the runtime type of the object.
    read-only, inherited
    subtype String
    read / write
    type String
    read / write


    checkParameters(String attribute, String value) → void
    getCharSet() String
  • Return the character set, as indicated by a charset parameter, if any.
    • @return the character set, or null if not available
  • getParameter(String name) String
  • Return a generic parameter value, given a parameter name.
    • @param name the parameter name
    • @return the parameter value, or null if not present
  • getParameters() Map
    getSubtype() String
  • Return the subtype.
  • getType() String
  • Return the primary type.
  • includes(MimeType other) bool
  • Indicate whether this MediaType includes the given media type.
    • For instance, text includes text/plain and text/html,
      • and application+xml includes application/soap+xml, etc. This
      • method is not symmetric.
      • @param other the reference media type with which to compare
      • @return true if this media type includes the given media type;
      • false otherwise
  • isCompatibleWith(MimeType other) bool
    isConcrete() bool
  • Indicates whether this media type is concrete, i.e. whether neither the type
    • nor the subtype is a wildcard character.
    • @return whether this media type is concrete
  • isQuotedString(String s) bool
    isWildcardSubtype() bool
  • Indicates whether the subtype is the wildcard
    • character or the wildcard character followed by a suffix.
    • @return whether the subtype is a wildcard
  • isWildcardType() bool
  • Indicates whether the getType is the wildcard character
    • or not.
  • noSuchMethod(Invocation invocation) → dynamic
    Invoked when a non-existent method or property is accessed. [...]
    toString() String
    A string representation of this object. [...]
    unquote(String s) String


    operator ==(Object other) bool
    The equality operator. [...]

    Static Properties


    Static Methods

    valueOf(String value) MimeType
  • Parse the given String value into a MimeType object,
    • with this method name following the 'valueOf' naming convention
    • @see MimeTypeUtils#parseMimeType(String)