ApiService class

Central API Service Class Handles all HTTP operations with comprehensive error handling and logging

Constructors

ApiService()
factory

Properties

config → ApiConfig
Get config instance
no setter
dio → Dio
Get Dio instance (for advanced usage)
no setter
downloadHelper → DownloadHelper
Get download helper instance
no setter
hashCode → int
The hash code for this object.
no setterinherited
logger → ApiLogger
Get logger instance
no setter
networkChecker → NetworkChecker
Get network checker instance
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelAllDownloads() → void
Cancel all downloads
cancelDownload(String url) → void
Cancel download
delete<T>(String endpoint, {dynamic data, Map<String, dynamic>? queryParameters, Map<String, dynamic>? headers, bool overrideGlobalError = false, bool? retry, bool checkInternet = true, Duration? timeout, T parser(dynamic)?}) → Future<ApiResponse<T>>
DELETE request
dispose() → void
Dispose resources
downloadFile({required String url, String? savePath, String? filename, Map<String, dynamic>? headers, dynamic onProgress(int received, int total)?, CancelToken? cancelToken}) → Future<DownloadResult>
Download file
downloadImage({required String url, String? savePath, String? filename, Map<String, dynamic>? headers, dynamic onProgress(int received, int total)?}) → Future<DownloadResult>
Download image
downloadMultiple({required List<String> urls, String? saveDirectory, Map<String, dynamic>? headers, dynamic onProgress(String url, int received, int total)?}) → Future<List<DownloadResult>>
Download multiple files
downloadVideo({required String url, String? savePath, String? filename, Map<String, dynamic>? headers, dynamic onProgress(int received, int total)?}) → Future<DownloadResult>
Download video
get<T>(String endpoint, {Map<String, dynamic>? queryParameters, Map<String, dynamic>? headers, bool overrideGlobalError = true, bool? retry, bool checkInternet = true, Duration? timeout, T parser(dynamic)?}) → Future<ApiResponse<T>>
GET request
initialize() → void
Initialize API service
multiRequest(List<Future<ApiResponse>> requests) → Future<List<ApiResponse>>
Execute multiple requests in parallel
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch<T>(String endpoint, {dynamic data, Map<String, dynamic>? queryParameters, Map<String, dynamic>? headers, bool overrideGlobalError = false, bool? retry, bool checkInternet = true, Duration? timeout, T parser(dynamic)?}) → Future<ApiResponse<T>>
PATCH request
post<T>(String endpoint, {dynamic data, Map<String, dynamic>? queryParameters, Map<String, dynamic>? headers, bool overrideGlobalError = false, bool? retry, bool checkInternet = true, Duration? timeout, T parser(dynamic)?}) → Future<ApiResponse<T>>
POST request
put<T>(String endpoint, {dynamic data, Map<String, dynamic>? queryParameters, Map<String, dynamic>? headers, bool overrideGlobalError = false, bool? retry, bool checkInternet = true, Duration? timeout, T parser(dynamic)?}) → Future<ApiResponse<T>>
PUT request
toString() → String
A string representation of this object.
inherited

Operators

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