doPOST method

Future doPOST(
  1. String url,
  2. dynamic body, {
  3. Map<String, String>? headers,
})

Implementation

Future doPOST(String url, dynamic body, {Map<String, String>? headers}) async {
  headers = _headers(headers);
  url = _url(url);

  var res = await post(url, jsonEncode(body), headers: headers);

  if (res.statusCode == 401) {
    if (await _refreshToken()) {
      headers = _headers(headers);
      res = await post(url, jsonEncode(body), headers: headers);
    }
  }

  return _checkResponse(res);
}