contentType property
The content type of the file if provided.
Implementation
@override
Future<String?> get contentType => _contentTypeMemo.runOnce(() async {
final externalContentType = await super.contentType;
if (externalContentType != null) {
return externalContentType;
}
String? blobType;
final file = _inputFile ?? _inputBlob;
final path = super.path;
if (file != null) {
blobType = file.type;
} else if (path != null) {
blobType = (await _resolvedBlob).type;
}
// on Web blob.type may return an empty string
// https://developer.mozilla.org/en-US/docs/Web/API/Blob/type#value
if (blobType != null) {
return blobType.isEmpty ? null : blobType;
}
return blobType;
});