ApiHelper class

Main API Helper class that handles all HTTP operations

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

addInterceptor(ApiInterceptor interceptor) → void
Add an interceptor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeInterceptor(ApiInterceptor interceptor) → void
Remove an interceptor
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance ApiHelper
no setter

Static Methods

clearCache() Future<void>
Clear all cache
clearCacheForUrl(String url) Future<void>
Clear specific cache
configure(ApiConfig config) → void
Configure the API Helper with global settings
delete<T>(String endpoint, {Map<String, String>? headers, Map<String, dynamic>? queryParams, RetryConfig? retry, Duration? timeout}) Future<T>
Make a DELETE request
downloadFile(String endpoint, String savePath, {Map<String, String>? headers, void onProgress(int received, int total)?}) Future<void>
Download a file
get<T>(String endpoint, {Map<String, String>? headers, Map<String, dynamic>? queryParams, CacheConfig? cache, RetryConfig? retry, Duration? timeout}) Future<T>
Make a GET request
hasNetwork() Future<bool>
Check network connectivity
patch<T>(String endpoint, {dynamic data, Map<String, String>? headers, Map<String, dynamic>? queryParams, RetryConfig? retry, Duration? timeout}) Future<T>
Make a PATCH request
post<T>(String endpoint, {dynamic data, Map<String, String>? headers, Map<String, dynamic>? queryParams, RetryConfig? retry, Duration? timeout}) Future<T>
Make a POST request
put<T>(String endpoint, {dynamic data, Map<String, String>? headers, Map<String, dynamic>? queryParams, RetryConfig? retry, Duration? timeout}) Future<T>
Make a PUT request
uploadFile<T>(String endpoint, File file, {String fieldName = 'file', Map<String, String>? fields, Map<String, String>? headers, void onProgress(int received, int total)?}) Future<T>
Upload a file