Let me explain, I have two listeners, one in ScreenA, and another in ScreenB, however both have the same state that does different actions, example:
ScreenA
listener : (BuildContext context, StateA state) {
if (state is SuccessB) {
... show snackbar
}
if (state is GoToScreenBState) {
Navigator.of(context).pushReplacementNamed(PageNames.screenB);
}
ScreenB
listener : (BuildContext context, StateA state) {
if (state is SuccessB) {
... another code
BlocProvider.of<ABloc>(context).add(GoToScreenAEvent()); // emit the GoToScreenAState
}
if (state is GoToScreenAState) { // this is the state above
Navigator.of(context).pushReplacementNamed(
PageNames.screenA,
(Route<dynamic> route) => false,
); // return to A
}
Now, when I go back to ScreenA, I emit again SuccessB so that the listener of that screen is executed, but also the one of ScreenB is executed, I don't understand why if I already navigue and replace...
Any idea ?