networkInformation function
Access to a stream of NetworkInformation
.
Whenever NetworkInformation
changes, this provider will be updated.
Implementation
@riverpod
NetworkInformation networkInformation(Ref ref) {
final tNetworkPlugin = ref.read(appProvider).getPlugin<NetworkPlugin>()!;
final tSubscription = tNetworkPlugin.informationStream.listen((event) {
ref.invalidateSelf();
});
ref.onDispose(tSubscription.cancel);
return tNetworkPlugin.information;
}