multipartRequest method
Make an API post multipart form call
! Do not support mockClient
Implementation
Future<http.StreamedResponse> multipartRequest(
String endpoint, File fileAsset, String fileFieldName, String? fileName, Map<String, dynamic>? body, String? token,
{ApiType apiType = ApiType.POST}) async {
String currentApiType = this.apiType(apiType);
var request = http.MultipartRequest(currentApiType, Uri.parse(endpoint));
if (token != null) {
Map<String, String> customHeaders = {this.headerAuthKey: token};
request.headers.addAll(customHeaders);
}
request.files.add(http.MultipartFile.fromBytes(fileFieldName, fileAsset.readAsBytesSync(), filename: fileName));
return request.send();
}