In main.dart there are 2 BlocProviders. I am not an expert on bloc however I thought we should have the BlocProvider on top level and when we want to use it we use "context.of." to access it inside ContainerPage. Sorry if this is the normal usage
void main() {
runApp(MaterialApp(
home: Scaffold(
body: BlocProvider(
builder: (BuildContext context) => FragmentBloc(),
child: ContainerPage()),
),
));
}
class ContainerPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
FragmentManager().setRoutes(<String, Widget>{
FRAGMENT_1: Fragment1(),
FRAGMENT_2: Fragment2(),
FRAGMENT_3: Fragment3(),
FRAGMENT_4: Fragment4(),
});
return BlocProvider<FragmentBloc>(
builder: (BuildContext context) => FragmentBloc(),
child: