getMultiPartFromFile method

Future<MultipartFile>? getMultiPartFromFile(
  1. File file
)

its used to get multipart file from any extension.

Implementation

Future<MultipartFile>? getMultiPartFromFile(File file) async {
  String? mimeType = mime(file.absolute.path);
  String mimee = mimeType!.split('/')[0];
  String type = mimeType.split('/')[1];
  print("MIME TYPE ${mimeType}  , ${mimee}, ${type} ");
  var pic = await MultipartFile.fromFile(file.path,
      filename: file.path.split("/").last,
      contentType: MediaType(mimee, type));
  return pic;
}