RestApi class

Handler for RESTful external communications. Applications will need a unique RestApi instane for every different API with which they communicate.

Supply a headersBuilder to build headers dynamically for this request. Note that the value returned by headersBuilder will have the individual ApiRequest's headers merged in.

Constructors

RestApi({required String apiBaseUrl, required HeadersBuilder headersBuilder, RequestDelegate? delegate, bool forceEndingSlash = false, Level logLevel = Level.FINER})
Handler for RESTful external communications. Applications will need a unique RestApi instane for every different API with which they communicate.

Properties

apiBaseUrl String
Root of this API's url. Should include the scheme, optional subdomain, domain, and TLD.
final
forceEndingSlash bool
Whether to force a trailing slash on the end of the final Uri.
final
hashCode int
The hash code for this object.
no setterinherited
headersBuilder HeadersBuilder
Function to return the necessary headers for a given request. The "Content-Type" and authorization headers are handled automatically, so this function should only build any other headers.
final
logLevel → Level
Logging level for this instance.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(WriteApiRequest request) Future<ApiResult>
Sends a DELETE request via the RequestDelegate.
get(ReadApiRequest request) Future<ApiResult>
Sends a GET request via the RequestDelegate.
getDefaultHeaders({String? contentType, String? accept}) Map<String, String>
Builds default headers for all network requests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(WriteApiRequest request) Future<ApiResult>
Sends a POST request via the RequestDelegate.
toString() String
A string representation of this object.
inherited
update(WriteApiRequest request, {bool partial = false}) Future<ApiResult>
Sends a PUT or PATCH request via the RequestDelegate.

Operators

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