MediaType class Null safety

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)
const

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
isApplication bool
Convenience getter to check of the top MediaTopType is application
read-only
isAudio bool
Convenience getter to check of the top MediaTopType is audio
read-only
isFont bool
Convenience getter to check of the top MediaTopType is font
read-only
isImage bool
Convenience getter to check of the top MediaTopType is image
read-only
isMessage bool
Convenience getter to check of the top MediaTopType is message
read-only
isModel bool
Convenience getter to check of the top MediaTopType is model
read-only
isMultipart bool
Convenience getter to check of the top MediaTopType is multipart
read-only
isText bool
Convenience getter to check of the top MediaTopType is text
read-only
isVideo bool
Convenience getter to check of the top MediaTopType is video
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
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 non-existent 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
MediaType('text/plain', MediaToptype.text, MediaSubtype.textPlain)