ApiClient class

A client for making network requests with built-in error handling and support for various request types.

This class uses Custom Dio Client for HTTP requests and supports functionalities such as adding authorization headers, including default parameters, and transforming responses using custom serializers.

Constructors

ApiClient({required Dio dio, required Connectivity connectivity})
Creates an instance of ApiClient.

Properties

connectivity → Connectivity
Provides network connectivity status.
final
defaultParams Map<String, dynamic>
Default parameters to include in every request.
getter/setter pair
dio → Dio
The underlying Dio instance for configuration and advanced use cases.
final
dioClient DioClient
The Custom Dio client for making HTTP requests.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request<T, U>({required RequestType requestType, bool requiresAuth = true, bool requiresDefaultParams = true, required String path, Map<String, dynamic>? queryParameters, Map<String, dynamic>? data, Map<String, dynamic>? headers, bool isBodyJsonToString = false, String jsonToStringBody = "", required T fromJsonSuccess(Map<String, dynamic>), required U fromJsonError(Map<String, dynamic>, int), required String publicKey}) Future<NetworkResponse>
Sends an HTTP request and handles the response.
toString() String
A string representation of this object.
inherited

Operators

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