fromSubtype static method
Creates a media type from the specified subtype
.
Implementation
static MediaType fromSubtype(MediaSubtype subtype) {
for (var key in _subtypesByMimeType.keys) {
var sub = _subtypesByMimeType[key];
if (sub == subtype) {
var splitPos = key.indexOf('/');
if (splitPos != -1) {
var topText = key.substring(0, splitPos);
var top = _topLevelByMimeName[topText] ?? MediaToptype.other;
return MediaType(key, top, subtype);
}
break;
}
}
print('Error: unable to resolve media subtype $subtype');
return MediaType('example/example', MediaToptype.other, subtype);
}