getMultiPartImage method

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

This function is used for convert image file to Multipart to uplaod using Dio

Implementation

Future<MultipartFile>? getMultiPartImage(File file) async {
  var pic = await MultipartFile.fromFile(file.path,
      filename: file.path.split("/").last,
      contentType:
          httparser.MediaType.parse("image/${file.path.split(".").last}"));
  return pic;
}