postBody method

Future<String> postBody(
  1. Uri uri, {
  2. Map<String, String>? headers,
})

Returns the body of the given uri after a POST request. This process is async, thus the body is returned as a future String instance.

Implementation

Future<String> postBody(Uri uri, {Map<String, String>? headers}) async {
  final res = await postResponse(uri, headers: headers);
  if (isErrorCode(res.statusCode)) {
    throw SessionInvalidException(res.statusCode);
  }
  return res.body;
}