quickapi 2.0.0
quickapi: ^2.0.0 copied to clipboard
A modern, feature-rich Flutter HTTP client with caching, retries, interceptors, and advanced error handling
2.0.0 - 2025-01-28 #
🎉 Major Modernization Release #
This is a major update with significant improvements, new features, and modern Dart patterns.
✨ Added #
New HTTP Methods
- PATCH method support (
patch()) - HEAD method support (
head()) - OPTIONS method support (
options())
Enhanced API
- Query Parameters: All methods now support
queryParametersfor URL query strings - Request Cancellation:
CancelTokenfor canceling in-flight requests - Progress Callbacks: Upload progress tracking for multipart requests via
onProgress - Cache Management:
clearCache()method to clear all cached responsescacheSizegetter to check current cache sizemaxCacheSizeconfiguration to limit cache entries
- Exponential Backoff: Configurable exponential backoff for retry attempts
- Advanced Timeout Handling: Separate
connectTimeout,readTimeout, andwriteTimeoutconfigurations
Modern Dart Features
- Sealed Classes: All error types now use Dart 3 sealed classes for better type safety
- Improved Type Safety: Generic retry methods and better null safety
- Comprehensive Documentation: Full API documentation with dartdoc comments
Enhanced Interceptors
- Error Handling: New
onError()method in interceptors for error handling - Abort on Error:
shouldAbortOnErrorflag to control interceptor behavior - Better Context: Request and response contexts include more information
Improved Logging
- Structured Logging: Logger now uses levels (INFO, ERROR, DEBUG, WARN)
- Better Logging Interceptor: Enhanced
LoggingInterceptorwith custom logger support
🔄 Changed #
API Method Names (Breaking Changes)
typeGet()→get()(old method deprecated but still works)typePost()→post()(old method deprecated but still works)typePut()→put()(old method deprecated but still works)typeDelete()→delete()(old method deprecated but still works)typePostMultipart()→postMultipart()(old method deprecated but still works)
Error Classes (Breaking Changes)
- All error constructors now require
endpointparameter TimeoutErrornow requirestimeoutDuration parameter- Error messages now include endpoint information
Logger Signature (Breaking Change)
- Logger function signature changed from
void Function(String)tovoid Function(String level, String message)
Builder Pattern Enhancements
- New
cache()method for cache configuration - New
connectTimeout(),readTimeout(),writeTimeout()methods - Enhanced
retry()method with exponential backoff options
🐛 Fixed #
- Improved error handling with better exception catching
- Fixed URL building with proper query parameter merging
- Better null safety throughout the codebase
- Fixed interceptor error handling
- Improved cache key generation
📝 Documentation #
- Complete API documentation
- Updated examples in README
- Updated test files
🔧 Technical Improvements #
- Removed unused
shared_preferencesdependency - Better URI construction and query parameter handling
- Improved retry logic with exponential backoff
- Enhanced error context in all error types
⚠️ Migration Guide #
If you're upgrading from 1.x:
-
Update method names:
// Old api.typeGet('/users'); // New api.get('/users'); -
Update logger signature:
// Old logger: (message) => print(message) // New logger: (level, message) => print('[$level] $message') -
Update error handling (if creating errors manually):
// Old throw NetworkError('Connection failed'); // New throw NetworkError('Connection failed', '/endpoint'); -
Use new features:
// Query parameters api.get('/users', queryParameters: {'page': 1, 'limit': 10}); // Request cancellation final cancelToken = CancelToken(); api.get('/users', cancelToken: cancelToken); cancelToken.cancel(); // Cache management api.clearCache(); print('Cache size: ${api.cacheSize}');
1.0.0 - 2025-01-28 #
Added #
- Initial release of the QuickApi package.
- Support for GET, POST, PUT, DELETE requests.
- Support for multipart POST requests (file uploads).
- Implemented caching, retries, and timeout handling.
- Added interceptors for custom request/response handling.
- Detailed error handling with custom error classes (TimeoutError, NetworkError, etc.).
Fixed #
- Various bug fixes related to request handling and error messages.