quickapi 2.0.0 copy "quickapi: ^2.0.0" to clipboard
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 queryParameters for URL query strings
  • Request Cancellation: CancelToken for canceling in-flight requests
  • Progress Callbacks: Upload progress tracking for multipart requests via onProgress
  • Cache Management:
    • clearCache() method to clear all cached responses
    • cacheSize getter to check current cache size
    • maxCacheSize configuration to limit cache entries
  • Exponential Backoff: Configurable exponential backoff for retry attempts
  • Advanced Timeout Handling: Separate connectTimeout, readTimeout, and writeTimeout configurations

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: shouldAbortOnError flag 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 LoggingInterceptor with 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 endpoint parameter
  • TimeoutError now requires timeout Duration parameter
  • Error messages now include endpoint information

Logger Signature (Breaking Change)

  • Logger function signature changed from void Function(String) to void 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_preferences dependency
  • 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:

  1. Update method names:

    // Old
    api.typeGet('/users');
    // New
    api.get('/users');
    
  2. Update logger signature:

    // Old
    logger: (message) => print(message)
    // New
    logger: (level, message) => print('[$level] $message')
    
  3. Update error handling (if creating errors manually):

    // Old
    throw NetworkError('Connection failed');
    // New
    throw NetworkError('Connection failed', '/endpoint');
    
  4. 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.
4
likes
140
points
14
downloads

Publisher

verified publishertechweblabs.com

Weekly Downloads

A modern, feature-rich Flutter HTTP client with caching, retries, interceptors, and advanced error handling

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

connectivity_plus, flutter, http

More

Packages that depend on quickapi