@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider<TripDetailBloc>(create: (BuildContext context) => TripDetailBloc()),
BlocProvider<PopUpBloc>(create: (BuildContext context) => PopUpBloc()),
],
child: Scaffold(
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
BlocProvider.of<TripDetailBloc>(context).add(AddTripDetailPannelEvent());
},
),
appBar: appbar(),
body: pannel(),
)
);
}
The following assertion was thrown while handling a gesture:
- BlocProvider.of() called with a context that does not contain a Bloc of type TripDetailBloc.
- No ancestor could be found starting from the context that was passed to
BlocProvider.of
<TripDetailBloc>()
. - This can happen if the context you used comes from a widget above the BlocProvider.
- he context used was: TripDetailPage(dependencies: [MediaQuery], state: _TripDetailPageState#d4ab3)