postMultipartData method

Future<Response?> postMultipartData(
  1. String endpoint, {
  2. Map<String, dynamic>? headers,
  3. required File file,
  4. required String paramName,
  5. required String filename,
})

Implementation

Future<Response?> postMultipartData(String endpoint,
    {Map<String, dynamic>? headers,
    required File file,
    required String paramName,
    required String filename}) async {
  final Map<String, MultipartFile> multipartData = {
    paramName:
        await MultipartFile.fromFile(file.uri.path, filename: filename),
  };
  final formData = FormData.fromMap(multipartData);
  return postData(endpoint, formData, headers: headers);
}