mimalo function

String? mimalo({
  1. required String filePathOrExtension,
})

Get ContentType from extension or path. Returns null if there is no MIME type asociated with the extension on this library.

Implementation

String? mimalo({
  required String filePathOrExtension,
}){
  String fileExtension = filePathOrExtension.substring(filePathOrExtension.lastIndexOf("."));
  List<String> extensions = _mimeTypes.keys.toList();
  int extensionIndex = extensions.indexOf(fileExtension);
  if(extensionIndex == -1){
    return null;
  }else{
    String typeOfContent = _mimeTypes[extensions[extensionIndex]]!;
    return typeOfContent;
  }
}