flutter_network_state 1.1.0
flutter_network_state: ^1.1.0 copied to clipboard
Network-aware state management engine for Flutter. Offline queue, cache strategies, Dio interceptor, auto-sync, and Bloc-friendly sealed states.
Changelog #
1.1.0 #
🚀 Feature Release #
Persistent Queue
- Added
PersistentQueueStore— JSON file-based queue that survives app restarts - Added
SerializableRequestmodel for disk-safe HTTP request metadata - Added
RequestExecutorcallback for replaying persisted requests - Added
HiveQueueStorereference implementation (doc/hive_queue_store.md) - Added
SqfliteQueueStorereference implementation (doc/sqflite_queue_store.md)
Real Internet Verification
- Added
InternetChecker— DNS lookup-based connectivity verification - Detects captive portals, DNS failures, and firewalled connections
- Periodic monitoring with deduped status stream
Reactive Widgets
- Added
NetworkBuilder— rebuilds UI based onNetworkStatestream - Added
ConnectivityBuilder— shows online/offline UI branches
State Management
- Added
NetworkNotifierextension for Provider (ChangeNotifier) - Added
NetworkCubitstandalone Cubit base class - Added
NetworkStateNotifierextension for Riverpod
Testing
- Added 80+ unit tests covering core, cache, queue, persistent queue, and retry
Dependencies
- Upgraded
connectivity_plusto^7.0.0 - Upgraded
metato^1.16.0 - Bumped minimum Flutter version to
>=3.19.0
Fixes
- Fixed GitHub repository URLs for pub.dev
- Shortened package description for pub.dev compliance
1.0.0 #
🎉 Initial Release #
Core
- Sealed
NetworkStatehierarchy:Idle,Loading,Offline,Syncing,Success<T>,Error - Sealed
NetworkStrategy:NetworkFirst,CacheFirst,CacheOnly,NetworkOnly - Stream-based
NetworkStatusMonitorwrappingconnectivity_plus - Pluggable
NetworkLoggerwith severity levels (debug, info, warning, error)
Request Orchestration
NetworkManager.request<T>()API with strategy-based resolution- Automatic cache fallback on network failure (NetworkFirst / CacheFirst)
- Offline request queueing with per-request retry policies
Cache
- In-memory
CacheManagerwith TTL support - Pluggable
CacheStoreinterface for custom persistence (Hive, Isar, etc.)
Queue & Sync
- FIFO
RequestQueuewith pluggableQueueStore SyncEngine— automatically drains queue on connectivity restore- Progress tracking via
Syncingstate (completedRequests / totalRequests)
Retry
RetryPolicywith configurable max retriesExponentialBackoffwith ±25% jitterLinearBackoffandConstantBackoffalternatives- Custom
shouldRetrypredicate support
Dio Integration
NetworkDioInterceptor— drop-in interceptor for anyDioinstance- Auto-retry on transient failures (timeouts, 500, 502, 503, 429)
- Automatic offline queueing and replay
- Configurable request/response/error logging
State Management
NetworkNotifier—ChangeNotifierwrapper for ProviderNetworkCubit— standalone Cubit base class (noflutter_blocdependency)executeAndEmit()/bindToEmit()— extensions forflutter_blocCubit/BlocNetworkStateNotifier— Riverpod-compatible notifier withexecute()helpercreateNotifier()— extension onNetworkManagerfor Riverpod providersasNetworkStates()— transform anyStream<T>intoStream<NetworkState>- Zero external state management dependencies — all built on Flutter SDK primitives