api_network_kit 1.1.2 copy "api_network_kit: ^1.1.2" to clipboard
api_network_kit: ^1.1.2 copied to clipboard

A batteries-included, no-codegen Dio wrapper for Flutter/Dart featuring typed parsing, resilient retry, automatic token refresh, caching, pagination, and WASM-ready checks.

1.1.2 #

  • WASM Compatibility Fix: Replaced the external package:logger dependency with a custom, fully WASM-compatible console logger (ApiLogger) built directly into the package. This removes the dart:io dependency transitively introduced by the logger, resolving the WASM/Web compatibility issue.
  • cURL Request Logging: Implemented a cURL command generator in ApiInterceptor that prints a developer-friendly, ready-to-run cURL command for every HTTP request.
  • Updated Environment Constraints: Updated environment targets in pubspec.yaml to Dart >=3.4.0 <4.0.0 and Flutter >=3.22.0 to comply with modern WASM compilation pipelines.

1.1.1 #

  • Shortened package description in pubspec.yaml to comply with pub.dev package guidelines.
  • Wrapped generic type references in backticks in doc comments to resolve HTML parsing warnings during static analysis.

1.1.0 #

Breaking changes (non-API) #

  • Moved connectivity_plus and flutter_bloc from hard dependencies to dev_dependencies. The library no longer forces Flutter or native plugins on pure-Dart / Web / WASM consumers.
  • Moved the clean-architecture auth example from lib/features/auth/ into example/auth_feature/. It was never part of the published library API.

New features #

  • Automatic token refresh & retry (Priority 2): Added a TokenRefresher strategy and TokenRefreshInterceptor. On a 401, the interceptor calls the refresher, updates the stored token, and retries the original request once. Infinite loops are prevented via a per-request flag.
  • Configurable pagination (Priority 3): Added PaginationStrategy, PaginationConfig, OffsetPaginationStrategy, and CursorPaginationStrategy. getPaginated now accepts an optional paginationConfig / paginationStrategy. Defaults preserve the legacy hardcoded shape.
  • Cache abstraction & request deduplication (Priority 4): Added a CacheStore interface; ApiCache now implements it with ETag storage. Added RequestDeduplicator so concurrent identical GETs share a single in-flight request. ETag headers are now captured from responses.
  • Web/WASM-ready connectivity (Priority 5): Added a ConnectivityChecker interface with a NoOpConnectivityChecker default, so the package runs on pure-Dart and Web/WASM without native plugins. Flutter consumers can inject a connectivity_plus-backed checker.
  • Injectable logger (Priority 6): ApiLogger is now instance-based and injectable, with a static facade for backward compatibility.

Bug fixes #

  • Fixed broken String parser path (Priority 1): parseResponse now JSON-decodes String bodies with jsonDecode instead of casting a String to Map (which always threw).
  • Preserved error response bodies (Priority 1): All exceptions now carry statusCode, data, and errors populated from error.response?.data, making 422 field-validation errors reachable.
  • Fixed clearInterceptors() (Priority 6): It now preserves the internal auth and token-refresh interceptors instead of removing them and silently breaking auth.
  • Added exhaustive handling of DioExceptionType.transformTimeout, connectionError, and badCertificate in mapDioError.

Tests #

  • Added a real test suite using http_mock_adapter: response parsing, error mapping per status code (incl. 422 body preservation), cache hit/miss/expiry, token injection, clearInterceptors auth preservation, connectivity checks, pagination strategies, and request deduplication.

Packaging #

  • Added topics: [http, network, api-client, dio, rest] for pub.dev discoverability.
  • Bumped version to 1.1.0.

1.0.3 #

  • Fixed Example tab detection on pub.dev by adding example/README.md.
  • Rewrote root README.md to properly document the package.

1.0.2 #

  • Updated repository link to point to the correct GitHub repository.

1.0.1 #

  • Upgraded dependencies to latest compatible versions.
  • Fixed all remaining code lints and static analysis warnings for maximum score.

1.0.0 #

  • Initial release of api_network_kit.
  • Scalable Flutter package featuring a reusable API client (api_kit) for robust HTTP handling using Dio.
  • Robust error handling, retry mechanism, connectivity checks, logging, and response caching.
7
likes
0
points
584
downloads

Publisher

unverified uploader

Weekly Downloads

A batteries-included, no-codegen Dio wrapper for Flutter/Dart featuring typed parsing, resilient retry, automatic token refresh, caching, pagination, and WASM-ready checks.

Repository (GitHub)
View/report issues

Topics

#http #network #api-client #dio #rest

License

unknown (license)

Dependencies

dio

More

Packages that depend on api_network_kit