MimeType class
Represents MIME-Type. Useful for Content-Type and file handling.
Supported aliases:
- json: application/javascript
- javascript, js: application/javascript
- jpeg: image/jpeg
- png: image/png
- text: text/plain
- html: text/html
- css: text/css
- zip: application/zip
- gzip, gz: application/gzip
- pdf: application/pdf
Properties
- charset → String?
-
final
- charsetEncoding → Encoding?
-
no setter
- fileExtension → String
-
Returns the common file extension for the MIME-Type.
no setter
- fullType → String
-
Returns
$type/$subType
.no setter - hasCharset → bool
-
Returns
true
if charset is defined.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- htmlTag → String?
-
Returns the HTML tag name for this MIME-Type.
no setter
- isAudio → bool
-
Returns
true
if this an audio MIME-Type.no setter - isBZip2 → bool
-
Returns
true
if is GZip.no setter - isCharsetLATIN1 → bool
-
Returns
true
if charset is LATIN-1.no setter - isCharsetUTF8 → bool
-
Returns
true
if charset is UTF-8.no setter - isCharsetUTF16 → bool
-
Returns
true
if charset is UTF-16.no setter - isCompressed → bool
-
Returns
true
if is a compression type.no setter - isDart → bool
-
Returns
true
if is a Dart script/code.no setter - isFont → bool
-
Returns
true
if this a font MIME-Type.no setter - isFormURLEncoded → bool
-
Returns
true
if isapplication/x-www-form-urlencoded
.no setter - isGZip → bool
-
Returns
true
if is GZip.no setter - isImage → bool
-
Returns
true
if this an image MIME-Type.no setter - isImageJPEG → bool
-
Returns
true
if this isimage/jpeg
.no setter - isImagePNG → bool
-
Returns
true
if this isimage/png
.no setter - isImageSVG → bool
-
Returns
true
if this isimage/svg+xml
.no setter - isImageWebP → bool
-
Returns
true
if this isimage/png
.no setter - isJavascript → bool
-
no setter
- isJSON → bool
-
Returns
true
if isapplication/json
.no setter - isOctetStream → bool
-
Returns
true
if isapplication/octet-stream
.no setter - isPDF → bool
-
Returns
true
if is PDF.no setter - isStringType → bool
-
Returns
true
if type is better represented as String.no setter - isTar → bool
-
Returns
true
if is Tar.no setter - isTarBZip2 → bool
-
Returns
true
if istar.bz2
.no setter - isTarCompressed → bool
-
Returns
true
if is Tar+Compression.no setter - isTarGZip → bool
-
Returns
true
if istar.gz
.no setter - isTarXZ → bool
-
Returns
true
if istar.xz
.no setter - isText → bool
-
Returns
true
if istext/*
.no setter - isVideo → bool
-
Returns
true
if this a video MIME-Type.no setter - isXHTML → bool
-
Returns
true
if is XHTML.no setter - isXML → bool
-
Returns
true
if is XML.no setter - isXZ → bool
-
Returns
true
if is XZ.no setter - isYAML → bool
-
Returns
true
if isapplication/yaml
.no setter - isZip → bool
-
Returns
true
if is Zip.no setter - preferredStringEncoding → Encoding?
-
The preferred String Encoding for this MIME-Type:
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subType → String
-
final
- type → String
-
final
Methods
-
fileName(
[String? identifier, String delimiter = '-']) → String -
Generates a file name for the type, using
identifier
as name and the corresponding fileExtension. -
fileNameRandom(
) → String - Generates a random file name for the type, with the corresponding fileExtension.
-
fileNameTimeMillis(
[int? timeMillis]) → String -
Generates a file name for the type, using
timeMillis
as name and the corresponding fileExtension. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
[bool? withCharset]) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
asString(
Object? mimeType, [String? defaultMimeType]) → String? -
Parses a
mimeType
to a MIME-Type string. -
byExtension(
String? extension, {bool defaultAsApplication = true}) → MimeType? -
Creates an instance by file
extension
. -
normalizeCharset(
String? charset) → String? -
parse(
String? mimeType, [String? defaultMimeType]) → MimeType? -
Constructor that parses a
mimeType
string. -
parseAsString(
String? mimeType, [String? defaultMimeType]) → String? -
Parses a
mimeType
string and returns as a normalized MIME-Type string. Note that this can resolve aliases likeJSON
.
Constants
- applicationDart → const String
- applicationGzip → const String
- applicationJavaScript → const String
- applicationJson → const String
- applicationOctetStream → const String
- applicationPDF → const String
- applicationXHTML → const String
- applicationXML → const String
- applicationYaml → const String
- applicationZip → const String
- audioMPEG → const String
- audioWebm → const String
- bytes → const String
- css → const String
- dart → const String
- fontOtf → const String
- fontTtf → const String
- fontWoff → const String
- fontWoff2 → const String
- gif → const String
- gzip → const String
- html → const String
- icon → const String
- imageGIF → const String
- imageIcon → const String
- imageJPEG → const String
- imagePNG → const String
- imageSVG → const String
- imageWebp → const String
- javaScript → const String
- jpeg → const String
- json → const String
- markdown → const String
- mp3 → const String
- mpeg → const String
- otf → const String
- pdf → const String
- png → const String
- svg → const String
- text → const String
- textCSS → const String
- textHTML → const String
- textMarkdown → const String
- textPlain → const String
- ttf → const String
- videoMPEG → const String
- videoWebm → const String
- weba → const String
- webm → const String
- webp → const String
- woff → const String
- woff2 → const String
- xhtml → const String
- xml → const String
- yaml → const String
- zip → const String