post<T> method
Implementation
Future<Response<T>> post<T>(
String? url, {
dynamic body,
String? contentType,
Map<String, String>? headers,
Map<String, dynamic>? query,
Decoder<T>? decoder,
ResponseInterceptor<T>? responseInterceptor,
Progress? uploadProgress,
// List<MultipartFile> files,
}) async {
try {
var response = await _performRequest<T>(
() => _request<T>(
url,
'post',
contentType: contentType,
body: body,
query: query,
decoder: decoder,
responseInterceptor: responseInterceptor,
uploadProgress: uploadProgress,
),
headers: headers,
);
return response;
} on Exception catch (e) {
if (!errorSafety) {
throw GetHttpException(e.toString());
}
return Future.value(Response<T>(
statusText: 'Can not connect to server. Reason: $e',
));
}
}