post method
Implementation
Future<Response<dynamic>> post(
String path, {
required Map<String, dynamic> data,
APIType apiType = APIType.public,
bool isFormData = false,
Map<String, dynamic>? headers,
Map<String, dynamic>? query,
}) async {
_setDioInterceptorList();
final standardHeaders = await _getOptions(apiType);
if (headers != null) {
standardHeaders.headers?.addAll(headers);
}
if (isFormData) {
standardHeaders.headers?.addAll({
'Content-Type': 'multipart/form-data',
});
} else {
if (headers != null) {
standardHeaders.headers?.addAll(headers);
}
}
return _dio
.post(
path,
data: isFormData ? FormData.fromMap(data) : data,
options: standardHeaders,
queryParameters: query,
)
.then((value) => value)
.catchError(_handleException);
}