felangel / bloc

A predictable state management library that helps implement the BLoC design pattern
https://bloclibrary.dev
MIT License
11.87k stars 3.4k forks source link

feat: State persistence for the widgets that are frequently in use. #4256

Closed sidharth-epi closed 1 month ago

sidharth-epi commented 2 months ago

Description

Like in a bottom navigation tabs, widgets that hold data once they have state, should persist no matter how many times i navigation through. So we need to keep their bloc in main file. So when we logout session and log-in to another account, what is the best way to make sure that all bloc instance are with initial state .

Desired Solution

When user is in Session and navigation through bottom navigation options the data state fetched should persist but when session is logged off, all the bloc kept in main should be disposed off or set to initial state.

Alternatives Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request go here.

felangel commented 1 month ago

Hi @sidharth-epi 👋 Thanks for opening an issue!

I highly recommend taking a look at the firebase_login example and you can check out the corresponding tutorial.

Hope that helps and if you still have questions I recommend joining the community on Discord, thanks!