ApiEndpoint<T extends Object> class abstract

The ApiEndpoint enumerates the properties needed to interact with a REST API endpoint.

ApiEndpoint exposes the following methods:

  • getJson asynchronously gets a JSON object from the endpoint.
  • postJson asyncronlously posts a JSON object to the endpoint.
  • get asynchronously gets an an object of type T from the API endpoint. from the API endpoint
Implementers

Constructors

ApiEndpoint({required JsonDeserializer<T> deserializer, required String host, required JsonSerializer<T> serializer, HttpHeaders? headers, String path = '', HttpProtocol protocol = HttpProtocol.https, QueryParameters? queryParameters})
A factory constructor that returns a ApiEndpoint from the parameters.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Returns the headers for the API endpoint request.
no setter
host String
The host part of the API endpoint request.
no setter
name String
Returns the name of the endpoint
no setter
path String
The path element for the API endpoint uri.
no setter
protocol HttpProtocol
The protocol of the API endpoint.
no setter
queryParameters Map<String, String>?
The query parameters for the endpoint.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get() Future<T?>
Asynchronously returns an object of type T from the API endpoint.
getJson() Future<Map<String, dynamic>?>
Asynchronously gets a JSON object from the API endpoint using GET.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(T? obj) Future<T?>
Asynchronously posts an obj of type T to the API endpoint using POST.
postJson(JSON? json) Future<Map<String, dynamic>?>
Asynchronously posts a json document to the API endpoint using POST.
toString() String
A string representation of this object.
inherited

Operators

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