mimetype static method

Future<String> mimetype(
  1. String path, {
  2. String defaultType = "",
})

Implementation

static Future<String> mimetype(String path, {String defaultType = ""}) async {
  String type;
  try {
    if (!_mimeLibraryLoaded) {
      await mime.loadLibrary();
      _mimeLibraryLoaded = true;
    }
    type = mime.lookupMimeType(path) ?? defaultType;
  } catch (e) {
    type = defaultType;
  }
  return type;
}