You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's the difference between exposing BLoC classes as single instance vs scoped instance? is it just a way to help structuring the code or has an effect on the app performance?
The text was updated successfully, but these errors were encountered:
When I implemented DI in this project. I didn't find a good solution for scoped instance. But in my opinion, you should scope your BLoC instances instead of making them all singleton because you should create an object when it is required and destroy them when its job is over.
I will look at the current implementation and see if there is a better solution to create scoped instances.
You said "you should create an object when it is required and destroy them when its job is over", but that happened with singleton too, it got created only when you enter the screen and it got destroyed when you leave it.
For example let's assume you created a BLoC for a "About us" which almost no one visit it, even if the BLoC of it is singleton and you can access it from anywhere it got created only once you are in About Us screen and it got destroyed when you leave it. so even if can access it from anywhere you only call it once you are in About Us screen.
Is what i'm saying true or did i miss something?
What's the difference between exposing BLoC classes as single instance vs scoped instance? is it just a way to help structuring the code or has an effect on the app performance?
The text was updated successfully, but these errors were encountered: