DEV Community

Discussion on: Cache API Integration with HydratedBLoC in Flutter (Source Codes Included)

Collapse
 
nombrekeff profile image
Keff

Interesting, I quite enjoyed this post. I have not used the bloc pattern much in flutter so I'm a bit of a newby.

I have a question though, where exactly is the cache implemented or what part handles the caching? does "HydratedBloc" cache stuff for you automatically? Or have I missed something?

I also see you setup HydrateBlock.storage, am I correct in asuming that the the state/data is also persistent in disk? Or is the storage just to store the cache?

Collapse
 
imransefat profile image
Imran Sefat

hydrated_bloc exports a Storage interface which means it can work with any storage provider. Out of the box, it comes with its own implementation: HydratedStorage.

HydratedStorage is built on top of hive for a platform-agnostic, performant storage layer. See the complete example for more details.

Copied from pub.dev

See the details here: pub.dev/packages/hydrated_bloc