I have bloc A
, created and provided above all the widgets of my app.
I have Bloc B
, created and provided in screen 1
.
Bloc B
has a reference to Bloc A
and can add events to Bloc A
inside mapEventToState
of Bloc B
.
Now the weird thing:
Inside screen 1, I have a BlocBuilder
of Bloc A
,
If I add events directly ( blocAReference.add(blockAEvent)
the BlocBuilder
gets called when the state changes),
However when I add an event indirectly to Bloc A
(blocBrefrence.add(blockBEvent)
and then inside mapEventToState
of Bloc B
I add event to Bloc A
), then the BlocBuilder
is not invoked (but I can assure by print
ing to console that the event was added to Bloc A
)
I am using the flutter_bloc
library.