getMultipartFile method
Implementation
Future<http.MultipartFile> getMultipartFile(String path) async {
// infer content type
String contentType;
String fileName = path.substring(path.lastIndexOf("/")+1).toLowerCase();
String ext = path.substring(path.lastIndexOf(".")+1).toLowerCase();
switch(ext) {
case "png":
contentType = "application/octet-stream";
break;
case "jpg":
case "jpeg":
contentType = "application/octet-stream";
break;
default:
contentType = "application/octet-stream";
break;
}
//return http.MultipartFile.fromPath(fileName, path, contentType: MediaType.parse(contentType) );
return http.MultipartFile.fromPath(fileName, path);
}