Generic bloc provider
hi
How to use generic bloc provider with this library? can you please explain ?
Thanks
Hello @gitflutter, checkout this example where you can find a generic bloc provider providing differents blocs: basics example.
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 ?
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.