post<T> method
Future<HttpResponse<T> >
post<T>(
- String uri, {
- dynamic data,
- Map<
String, dynamic> ? queryParameters, - Options? options,
- CancelToken? cancelToken,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
- HttpTransformer? httpTransformer,
- bool isShowLoading = true,
Implementation
Future<HttpResponse<T>> post<T>(String uri,
{data,
Map<String, dynamic>? queryParameters,
dio.Options? options,
dio.CancelToken? cancelToken,
dio.ProgressCallback? onSendProgress,
dio.ProgressCallback? onReceiveProgress,
HttpTransformer? httpTransformer,
bool isShowLoading = true}) async {
try {
if(isShowLoading) EasyLoading.show(status: 'loading...');
var response = await _dio.post(
uri,
data: data,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
if(isShowLoading) EasyLoading.dismiss();
return handleResponse(response, httpTransformer: httpTransformer);
} on Exception catch (e) {
if(isShowLoading) EasyLoading.dismiss();
return handleException(e);
}
}