HttpClient class

Wrapper for http requests

Constructors

HttpClient({required String baseUrl, Logger? logger, Map<String, String>? authorizationHeaders})
baseUrl - a root to which all request will be made authorizationHeaders - collection of headers which will be applied to all requests
const

Properties

authorizationHeaders Map<String, String>?
final
baseUrl String
final
hashCode int
The hash code for this object.
no setterinherited
logger Logger?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get<T>({required String path, required T decoder(Response), Map<String, Object> parameters = const {}, Map<String, String> headers = const {}}) Future<ApiResult<T>>
Executes HTTP GET request path - relative to baseUrl path decoder - function which will be called if http request was successful to convert http.Response to T parameters - collection of query parameters headers - collection of headers which should be applied to this request
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post<T>({required String path, required T decoder(Response), Map<String, Object> parameters = const {}, Map<String, String> headers = const {}, required dynamic body}) Future<ApiResult<T>>
Executes HTTP POST request path - relative to baseUrl path decoder - function which will be called if http request was successful to convert http.Response to T parameters - collection of query parameters headers - collection of headers which should be applied to this request body - http request body which will be encode to JSON
toString() String
A string representation of this object.
inherited

Operators

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