Bloc: Different HydratedBloc on a same Bloc

Created on 28 Nov 2020  路  2Comments  路  Source: felangel/bloc

Hello !

I've a question:
I have a single HydratedBloc that I use on 3 different pages. So I provide it 3 times.
The problem I have is that when I restart the app, the 3 pages get their state from the same HydratedBloc, so the 3 pages have the same state.
How can I use a same Bloc on different pages with a different Hydration ?

Thanks a lot for your help.

hydrated_bloc question

All 2 comments

Hi @Bligoubloups 馃憢
Thanks for opening an issue!

You can override the id getter on your HydratedBloc to differentiate between different caches for the same bloc type.

Hope that helps 馃憤

Thank you very much ! It helps :D

Was this page helpful?
0 / 5 - 0 ratings