gt_api library
A robust, elegant, and production-ready HTTP/REST API client wrapper for Flutter and Dart.
Exports core components including ApiService, ApiConfig, ApiException, ApiResponse, ApiLogger, NetworkChecker, RetryInterceptor, FormDataHelper, and DownloadHelper.
Classes
- ApiConfig
- Global API Configuration Class This class manages all API settings including base URL, headers, timeouts, and more.
- ApiLogger
- API Logger for beautiful console output Provides detailed logging for requests and responses
-
ApiResponse<
T> - Generic API Response Wrapper Provides structured response with generic type support
- ApiService
- Central API Service Class Handles all HTTP operations with comprehensive error handling and logging
- CancelToken
-
Controls cancellation of
Dio's requests. - DownloadHelper
- Download Manager for file downloads with progress tracking
- DownloadResult
- Download result model
- FileUploadItem
- Model for file upload item
- FormData
- A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
- FormDataHelper
- Helper class for creating FormData
- MultipartFile
-
An upload content that is a part of
MultipartRequest. This doesn't need to correspond to a physical file. - NetworkChecker
- Network Checker Utility Checks internet connectivity using connectivity_plus package
- RetryInterceptor
- Retry Interceptor for automatic retry on failed requests
Enums
- ApiExceptionType
- API Exception Types
- ResponseStatus
- Response Status
Extensions
- RetryOptionsExtension on RequestOptions
- Extension on RequestOptions to easily add retry configuration
Exceptions / Errors
- ApiException
- Custom API Exception Model Provides structured error information for all API failures