Closed dyardy closed 2 years ago
Hi @dyardy,
Thanks for pointing it out. Please follow this branch for upcoming changes: https://github.com/zubairehman/flutter-boilerplate-project/tree/feature/mvi
I will make sure to merge the DI-related changes in the master branch as well. Let me know if you have any comments.
Thanks
I am working through the architecture. Focused on PostStore
I see you are using GetIt as service locator, registering PostStore
(A)
getIt.registerSingleton(PostStore(getIt())); //within service_locator on startup
Within my_app.dart I then see creating new PostStore getting Repository with getIt
(1)
final PostStore _postStore = PostStore(getIt<Repository>());
Why is this necessary? Reading GetIt documentation (https://pub.dev/packages/get_it) it seems PostStore would have been available
i.e. var myAppModel = getIt(); like this (2)
final PostStore _postStore = getIt<PostStore>(getIt<Repository>());
or (3)final PostStore _postStore = getIt<PostStore>();
Q1 Why is it necessary to new up PostStore when it was already available via (2) or (3)?
Q2 Could it be that you do not need to register PostStore as singleton at all in (A)?