post static method
Future
post(
- String path, {
- bool isAuth = false,
- bool testMode = false,
- dynamic body,
- Map<
String, String> ? headers, - Map<
String, dynamic> ? query, - CancelToken? cancelToken,
- ResponseType responseType = ResponseType.map_data,
- dynamic onSendProgress()?,
- dynamic onReceiveProgress()?,
- bool ignoreOnAllError = false,
- int urlIndex = 0,
Sends an HTTP POST request.
Implementation
static Future<dynamic> post(String path,
{bool isAuth = false,
bool testMode = false,
dynamic body,
Map<String, String>? headers,
Map<String, dynamic>? query,
CancelToken? cancelToken,
ResponseType responseType = ResponseType.map_data,
Function(int, int)? onSendProgress,
Function(int, int)? onReceiveProgress,
bool ignoreOnAllError = false,
int urlIndex = 0}) async {
String error = _checkBeforeRequest(isAuth, urlIndex);
if (error.isNotEmpty) {
throw APIException(-1, body: error);
}
bool isUrl = path.startsWith('http');
return await DioApiST.instance.request(
type: 'POST',
method: !isUrl ? path : null,
baseUrl: isUrl ? path : null,
isAuth: isAuth,
testMode: testMode,
headers: headers,
queries: query,
responseType: responseType,
cancelToken: cancelToken,
data: body,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
ignoreOnAllError: ignoreOnAllError,
urlIndex: urlIndex);
}