post method

Future<Response> post(
  1. String path, {
  2. dynamic authenticated = true,
  3. Map<String, dynamic>? json,
  4. Map<String, dynamic>? queryParameters,
  5. Map<String, String>? headers,
})

Implementation

Future<http.Response> post(String path,
    {authenticated = true,
    Map<String, dynamic>? json,
    Map<String, dynamic>? queryParameters,
    Map<String, String>? headers}) {
  // build request

  final url = _buildUrl(path, queryParameters: queryParameters);
  final request = http.Request("POST", url);
  if (headers != null) request.headers.addAll(headers);

  // json body
  if (json != null) {
    request.body = jsonEncode(json);
    request.headers["content-type"] = "application/json";
  }

  // request
  return this.request(request, authenticated: authenticated);
}