MediaType class

Describes the media type of a MIME message part

Compare https://www.iana.org/assignments/media-types/media-types.xhtml for a list of common media types.

Constructors

MediaType(String text, MediaToptype top, MediaSubtype sub)
Creates a new media type
const
MediaType.fromSubtype(MediaSubtype subtype)
Creates a media type from the specified subtype.
factory
MediaType.fromText(String text)
Creates a media type from the specified text
factory
MediaType.guessFromFileExtension(String ext)
Tries to guess the media type from the specified file extension ext.
factory
MediaType.guessFromFileName(String fileNameOrPath)
Tries to guess the media type from fileNameOrPath.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isApplication bool
Convenience getter to check of the top MediaTopType is application
no setter
isAudio bool
Convenience getter to check of the top MediaTopType is audio
no setter
isFont bool
Convenience getter to check of the top MediaTopType is font
no setter
isImage bool
Convenience getter to check of the top MediaTopType is image
no setter
isMessage bool
Convenience getter to check of the top MediaTopType is message
no setter
isModel bool
Convenience getter to check of the top MediaTopType is model
no setter
isMultipart bool
Convenience getter to check of the top MediaTopType is multipart
no setter
isText bool
Convenience getter to check of the top MediaTopType is text
no setter
isVideo bool
Convenience getter to check of the top MediaTopType is video
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sub MediaSubtype
The sub-type of the media, e.g. text/plain
final
text String
The original text of the media type, e.g. 'text/plain' or 'image/png'.
final
top MediaToptype
The top level media type
final

Methods

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

Operators

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

Constants

textPlain → const MediaType
text/plain media type