JsonApi class abstract

The JsonApi provides methods for interacting with a RESTful/HTTP API:

  • the get method retrieves a JSON document from an HTTP endpoint; and
  • the post method posts a JSON document to the HTTP endpoint.
Implementers

Constructors

JsonApi()
Factory constructor that returns a const JsonApi instance.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get({required String host, String? path, Map<String, String>? queryParameters, Map<String, String>? headers, bool isHttps, Duration timeout}) Future<JSON>
Fetches the JSON object from the HTTP endpoint using the path, queryParameters and headers for the RESTful service host.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post({required String host, String? path, Map<String, String>? queryParameters, Map<String, String>? headers, JSON? body, bool isHttps = true}) Future<JSON?>
Posts JSON body to the HTTP endpoint using thehost, path, queryParameters and headers using HTTPS if isHttps.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

instance → const _JsonApiImpl
A global static JsonApi instance.