post method
Future
post(
- String uri, {
- dynamic data,
- Map<String, dynamic>? queryParameters,
- CancelToken? cancelToken,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
})
Implementation
Future<dynamic> post(
String uri, {
data,
Map<String, dynamic>? queryParameters,
Future<Map<String, dynamic>>? headers,
CancelToken? cancelToken,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
try {
final Response response = await _dio.post(
uri,
data: data,
queryParameters: queryParameters,
options: Options(
contentType: Headers.jsonContentType,
headers: await headers,
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return response.data;
} on DioError catch (e) {
final exeception = await _apiErrorHandler(e);
throw exeception;
}
}