Search code examples
flutterriverpodflutter-riverpod

How can I watch enum values changes using "select" method in Riverpod


enum ConnectivityResult {
  bluetooth,  
  wifi,
  ethernet,
  mobile,
  none
}
    

final connectivityProvider = StreamProvider<ConnectivityResult>((ref){
    ...
})

final repoProvider = FutureProvider<List>((ref) async {
  ref.watch(
    connectivityProvider.selectAsync(
      // WHAT DO TO HERE.
      (data) => ConnectivityResult.wifi,
    ),
  );
  ...
});

I want to listen only the "ConnectivityResult.wifi" to trigger rebuild for repoProvider.


Solution

  • Thanks to Randal comments and after reading the documentation, the problem is solved. Thanks a lot.