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.new(String text, MediaToptype top, MediaSubtype sub)
const

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 subtdetailed 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, e.g. text, image, video, audio, application, model, multipart or other
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

Static Methods

fromSubtype(MediaSubtype subtype) MediaType
Creates a media type from the specified subtype.
fromText(String text) MediaType
Creates a media type from the specified text The text must use the top/sub structure, e.g. 'text/plain'
guessFromFileExtension(String ext) MediaType
Tries to guess the media type from the specified file extension ext.
guessFromFileName(String fileNameOrPath) MediaType
Tries to guess the media type from the specified file name pr path fileNameOrPath.

Constants

textPlain → const MediaType