Bloc: Listener doesn't get fired, how can I debug it?

Created on 19 Nov 2019  路  1Comment  路  Source: felangel/bloc

In the root widget's initState, I create the bloc, and add listener to it like
bloc = new DynaBloc();
BlocListener(
bloc: bloc,
listener: (context, state) {
// do stuff here based on BlocA's state
var a=1;
}
);

and in build, I add it with value, like
body: BlocProvider.value(
value: bloc,
child: Builder(builder: (context) {
return mywidgets...;
);
})
I add a state, I can see from the delegate, it goes through, like
I/flutter ( 4560): Transition { currentState: Instance of 'DynaState', event: Instance of 'ClickEvent', nextState: Instance of 'DynaState' }

But the listener doesn't get call, any idea?

Most helpful comment

Figured it out, all are widget, I need put it in widget tree

>All comments

Figured it out, all are widget, I need put it in widget tree

Was this page helpful?
0 / 5 - 0 ratings