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

Generic bloc provider #5

Open
gitflutter opened this issue May 17, 2019 · 3 comments
Open

Generic bloc provider #5

gitflutter opened this issue May 17, 2019 · 3 comments
Labels
question Further information is requested

Comments

@gitflutter
Copy link

hi

How to use generic bloc provider with this library? can you please explain ?

Thanks

@frideosapps frideosapps added the question Further information is requested label May 18, 2019
@frideosapps
Copy link
Owner

Hello @gitflutter, checkout this example where you can find a generic bloc provider providing differents blocs: basics example.

@gitflutter
Copy link
Author

gitflutter commented May 21, 2019

what else if we have multiple blocs. Say I have 15 blocs ? Should I import all 15 blocs in main page ?
if We do like this any issues ?

@frideosapps
Copy link
Owner

You can import the blocs where you need it. If you use a provider the bloc is initialized before you pushing the screen and disposed when you leave it, so there is no issue if you have a lot of blocs. If you don't mind about leaving all in memory, you can also extend the AppStateModel class and declare all the blocs you need in that instance, then with the AppStateProvider you can provide the state of the app (and so every blocs that you declared) to every widget.

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

No branches or pull requests

2 participants