BaseHttp class
Base Http service file.
=> It contains all the basic required things for calling apis.
=> It also contains http cache data storage using GetStorage
=> All Authentication Services are also included. i.e :- Storing auth_data,token. Using Interceptors. declaring base api.
Constructors
- BaseHttp.new()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
get<
T> ({required String endPointURL, Map< String, dynamic> ? queryParameters, Map<String, dynamic> ? header, bool addToCache = true}) → Future<T?> - Base HTTP get request.
-
getStream(
{required String endPointURL, Map< String, dynamic> ? queryParameters, Map<String, dynamic> ? header, bool useCache = true}) → Stream - get request in form of stream.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post<
T> ({required String endPointURL, Map< String, dynamic> ? data, Map<String, dynamic> ? header, bool addToCache = true}) → Future<T?> - Base HTTP post request.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- apiCacheStorage → GetStorage
-
---------- Storage -------------------
no setter
- baseURL ↔ String
-
Set BASE-URL here!!
getter/setter pair
-
getAuthenticationStream
→ Stream<
AuthStatus> -
Listen to Auth Status Stream.
no setter
- isStorageReady ↔ bool
-
getter/setter pair
- maxRedirects ↔ int
-
Set MAX-REDIRECTS here!!
getter/setter pair
Static Methods
-
appendInterceptor(
InterceptorsWrapper interceptor) → dynamic - append an interceptor from here. all interceptors added in a row are executed one after another.
-
checkAuthStatus(
) → dynamic - Check authentication status.
-
clearCacheStorage(
) → dynamic - Clears the apiCacheStorage and clears the Stored Token.
-
closeAuthStatusResponse(
) → dynamic - Closes the auth status_check.
-
getAuthData(
) → dynamic - Get authentication data in apiCacheStorage.
-
getDefaultHeaders(
) → dynamic - Get Default Headers for HTTP Requests.
-
getToken(
) → String? - Get value of Stored Token.
-
initializeAPIServices(
) → dynamic - Initialization of API servicesBaseHttp
-
storeAuthData(
Map< String, dynamic> ? data) → dynamic - Store authentication data in apiCacheStorage.
-
storeDefaultHeaders(
Map< String, dynamic> ? header) → dynamic - Store Default Headers for HTTP Requests.
-
storeToken(
String token) → dynamic - Store Token Functionality.