ApiClient class abstract
Component for communication with an API.
Includes functionality for updating tokens if they are expired.
Constructors
-
ApiClient({required ApiEnvironment environment, required Dio dio, RefreshTokensDelegate? delegate, List<
HttpHeader> commonHeaders = const [], ErrorHandlerDelegate? errorHandlerDelegate})
Properties
-
commonHeaders
→ List<
HttpHeader> -
final
- delegate → RefreshTokensDelegate?
-
final
- dio → Dio
-
final
- environment → ApiEnvironment
-
final
- errorHandlerDelegate → ErrorHandlerDelegate?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearAuthTokens(
) → Future< void> -
delete<
T> ({required String path, required ResponseMapper< T> responseMapper, List<HttpHeader> headers = const [], Map<String, dynamic> queryParams = const {}, dynamic body, bool? isAuthorisedRequest, bool? validate, Duration? receiveTimeout, Duration? sendTimeout, String contentType = Headers.jsonContentType, CancelToken? cancelToken}) → Future<T> -
get<
T> ({required String path, required ResponseMapper< T> responseMapper, bool? isAuthorisedRequest, bool? validate, Map<String, dynamic> queryParams = const {}, List<HttpHeader> headers = const [], Duration? receiveTimeout, Duration? sendTimeout, String contentType = Headers.jsonContentType, CancelToken? cancelToken}) → Future<T> -
isAuthorised(
) → Future< bool> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch<
T> ({required String path, required ResponseMapper< T> responseMapper, List<HttpHeader> headers = const [], Map<String, dynamic> queryParams = const {}, ResponseType responseType = ResponseType.json, dynamic body, bool? isAuthorisedRequest, bool? validate, Duration? receiveTimeout, Duration? sendTimeout, String contentType = Headers.jsonContentType, CancelToken? cancelToken}) → Future<T> -
post<
T> ({required String path, required ResponseMapper< T> responseMapper, List<HttpHeader> headers = const [], Map<String, dynamic> queryParams = const {}, ResponseType responseType = ResponseType.json, dynamic body, bool? isAuthorisedRequest, bool? validate, Duration? receiveTimeout, Duration? sendTimeout, String contentType = Headers.jsonContentType, CancelToken? cancelToken}) → Future<T> -
put<
T> ({required String path, required ResponseMapper< T> responseMapper, List<HttpHeader> headers = const [], Map<String, dynamic> queryParams = const {}, ResponseType responseType = ResponseType.json, dynamic body, bool? isAuthorisedRequest, bool? validate, Duration? receiveTimeout, Duration? sendTimeout, String contentType = Headers.jsonContentType, CancelToken? cancelToken}) → Future<T> -
toString(
) → String -
A string representation of this object.
inherited
-
updateAuthTokens(
TokenPair tokenPair) → Future< void>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited