core/network_state library
Network states that represent the current lifecycle of a network-aware operation. These states are designed to be consumed by any state management solution (Bloc, Riverpod, Provider, etc.) via streams.
The state hierarchy is intentionally sealed to a known set so that exhaustive pattern matching works cleanly in Dart 3 switch expressions.
Classes
- Error
- An operation failed with an error.
- Idle
- Initial idle state — no operation in progress.
- Loading
- An operation is currently in progress.
- NetworkState
- Base class for all network states.
- Offline
- The device is currently offline. No network requests can be fulfilled from the network layer.
-
Success<
T> - An operation completed successfully.
- Syncing
- The sync engine is replaying queued requests after connectivity was restored.