How to access Provider providers in Dialogs in Flutter
Instead of passing the BLoC in the constructor, you can make use of BlocProvider.value. https://pub.dev/documentation/flutter_bloc/latest/flutter_bloc/BlocProvider/BlocProvider.value.html This will allow you to provide your existing BLoC instance to your new route (the dialog). And you still get all the benefits of InheritedWidget // Get the BLoC using the provider MyBloc myBloc = BlocProvider.of<MyBloc>(context); showDialog( context: context, builder: … Read more