isConnectedStream function Services
- @Riverpod(keepAlive: true)
- dynamic ref
A provider for a stream of booleans that represent the device's connectivity.
Implementation
@Riverpod(keepAlive: true)
Stream<bool> isConnectedStream(IsConnectedStreamRef ref) {
return Connectivity()
.onConnectivityChanged
.map((result) => !result.contains(ConnectivityResult.none));
}