postJSON method

Future postJSON(
  1. String path, {
  2. Map<String, String>? headers,
  3. Credential? authorization,
  4. Map<String, Object?>? parameters,
  5. Object? body,
  6. String? contentType,
})

Does a POST request and returns a decoded JSON.

Implementation

Future<dynamic> postJSON(String path,
    {Map<String, String>? headers,
    Credential? authorization,
    Map<String, Object?>? parameters,
    Object? body,
    String? contentType}) async {
  return post(path,
          headers: headers,
          authorization: authorization,
          parameters: parameters,
          body: body,
          contentType: contentType)
      .then((r) => _jsonDecode(r.bodyAsString));
}