canonicalMediaType method

Future<MediaType> canonicalMediaType()

Returns the canonical version of this media type, if it is known.

This is useful to find the name and file extension of a known media type, or to get the canonical media type from an alias. For example, application/x-cbz is an alias of the canonical application/vnd.comicbook+zip.

Non-significant parameters are also discarded.

Implementation

Future<MediaType> canonicalMediaType() async =>
    (await ofSingleHint(mediaType: toString())) ?? this;