class _HomePageState extends State<HomePage> {
late ArticleBloc articleBloc;
@override
void initState() {
super.initState();
articleBloc = BlocProvider.of<ArticleBloc>(context);
articleBloc.add(FetchArticlesEvent());
}
@override
Widget build(BuildContext context) {
return Container();
}
}
It works before but now the code wasn't working.
I try a lot to search but I failed.
This is the error:
Bad state: add(FetchArticlesEvent) was called without a registered event handler.
What is your bloc version? Maybe you are using v8.0.0
At the mention here. and the author's proposal for replacement.
In bloc v7.2.0, mapEventToState was deprecated in favor of on. mapEventToState will be removed in bloc v8.0.0.
So please check your bloc version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With