-
-
Notifications
You must be signed in to change notification settings - Fork 153
Object of type X is not registered inside GetIt #36
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
Comments
I have the same problem |
i have the same issue any solution if any |
same issue here, any solution? |
Can all that have the same problem raise a new issue with source code where you register and where you access your type? |
Hi @escamoteur, I'll open up another issue and link my github repo with my Flutter code, which is getting this error. You can then try and run the app in my repo and see if you can manage to reproduce it. |
I have the same issue. Using get_it from the operational flow works, but all initialization done from the test environment are lost when you invoke the application. @escamoteur Please let me know if you still need a small example project, I can prepare it ASAP. |
I have the same issue |
all that have problems Please open a new issue with the code where you register and where you use your Objects as well as the error code. |
Trying to create objects with get_it, although all the necessary objects are being registered as factories or lazy singletons, the library keeps saying that those objects are not registered.
final sl = GetIt.instance;
Future init() async {
sl.registerFactory(() => MoviesBloc(getMoviesWithPageUsecase: sl()));
sl.registerSingleton(() => GetMoviesWithPageUsecase(sl()));
sl.registerLazySingleton(
() => MoviesRepositoryImpl(
moviesLocalDataSource: sl(),
moviesRemoteDataSource: sl(),
networkInfo: sl()
)
);
sl.registerLazySingleton(
() => MoviesRemoteDataSourceImpl(client: sl())
);
sl.registerLazySingleton(
() => MoviesLocalDataSourceImpl(moviesBox: sl('moviesBox'))
);
sl.registerLazySingleton(
() => NetworkInfoImpl(sl())
);
final appDocumentDirectory = await path_provider.getApplicationDocumentsDirectory();
Hive.init(appDocumentDirectory.path);
final moviesBox = await Hive.openBox('movies');
sl.registerLazySingleton(() => http.Client());
sl.registerLazySingleton(() => DataConnectionChecker());
sl.registerLazySingleton(() => moviesBox,instanceName: 'moviesBox');
}
I call this method inside the main method and when I try to retrieve some object i always get the same error, example:
Invalid argument (Object of type GetMoviesWithPageUsecase is not registered inside GetIt):
The text was updated successfully, but these errors were encountered: