Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hydrated_bloc): use user provided storage in hydrated cubit #2578

Closed
wants to merge 1 commit into from

Conversation

elias8
Copy link

@elias8 elias8 commented Jun 27, 2021

Status

READY

Breaking Changes

NO

Description

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@elias8 elias8 requested a review from felangel as a code owner June 27, 2021 23:50
@dolsem
Copy link

dolsem commented Sep 18, 2021

Any status update on this? Would be great to have this feature!

@felangel
Copy link
Owner

Rather than injecting a storage into specific blocs I'd prefer to experiment with a HydratedStorageProvider that scopes different storage implementations to different parts of the widget tree. I was planning to revisit this within the next week or so (once v7.2.0 is out and a v8.0.0-dev release is published).

@elias8
Copy link
Author

elias8 commented Sep 23, 2021

@felangel I think that is a better approach! 👍

@felangel
Copy link
Owner

felangel commented Oct 6, 2021

Closing this PR for now in favor of the HydratedStorageProvider approach. I'll try to get to this in the next few days as part of the v8.0.0 release 👍

@felangel felangel closed this Oct 6, 2021
@dolsem
Copy link

dolsem commented Oct 6, 2021

@felangel would it be possible to use multiple storage providers with different blocs within the same widget? My use case is using flutter_secure_storage for auth tokens (auth cubit), and default storage for all other app data.

@felangel
Copy link
Owner

felangel commented Oct 6, 2021

@felangel would it be possible to use multiple storage providers with different blocs within the same widget? My use case is using flutter_secure_storage for auth tokens (auth cubit), and default storage for all other app data.

In that particular case you'd need to split the auth cubit BlocProvider into its own widget but I also don't recommend managing auth tokens in cubits/blocs. In my opinion, those should be managed by the networking layer using something like fresh_dio. Hope that helps 👍

@dolsem
Copy link

dolsem commented Oct 6, 2021

@felangel I see, interesting. I'll give fresh_dio a try, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Hydrated blocs with different storages in the same app
3 participants