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
now suggest that I already have an app that most of its current features depend on BaseMoviesRepository but I need to register BaseMovies2Repository because I need the new feature getPopular.
the problem here is GetIt does not recognize BaseMoviesRepository as a parent class of BaseMovies2Repository, so if I try
GetIt.I.registerSingleton<BaseNetworkService>(NetworkService());
GetIt.I.registerSingleton<BaseMovies2Repository>(Movies2Repository());
final moviesRepo = GetIt.I<BaseMoviesRepository>();
or
GetIt.I.registerSingleton<BaseNetworkService>(NetworkService());
GetIt.I.registerSingleton<BaseMoviesRepository>(Movies2Repository());
final moviesRepo = GetIt.I<BaseMovies2Repository>();
will throw
Failed assertion: line 372 pos 7: 'instanceFactory != null': Object/factory with type BaseMoviesRepository is not registered inside GetIt.
(Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;
Did you forget to register it?)
am I missing something here? or do I need to register a new instance instead?
The text was updated successfully, but these errors were encountered:
iandis
changed the title
How to make my app scalable using GetIt?
How to make my app easily being added new features using GetIt?
Aug 8, 2021
Uh oh!
There was an error while loading. Please reload this page.
Hi, thanks for your great library! However I need a way to make my app easily being added new features using GetIt.
For instance, I have an abstract base class
BaseMoviesRepository
with its implementation
then next time if I need to add a new feature, I don't want to add anything to
BaseMoviesRepository
, so I createwith its implementation
now suggest that I already have an app that most of its current features depend on
BaseMoviesRepository
but I need to registerBaseMovies2Repository
because I need the new featuregetPopular
.the problem here is GetIt does not recognize
BaseMoviesRepository
as a parent class ofBaseMovies2Repository
, so if I tryor
will throw
am I missing something here? or do I need to register a new instance instead?
The text was updated successfully, but these errors were encountered: