Closed
Description
Hi,
I am having a problem with the package. Inside of my injector class I am registering all my blocs, datasources etc.:
locator.registerLazySingleton<Dio>(() => Dio());
locator.registerLazySingleton(() => const FlutterSecureStorage());
locator.registerLazySingleton<UserRepository>(
() => UserRepositoryImpl(secureStorageDataSource: locator()),
);
locator.registerLazySingleton<KIBackendDatasource>(
() => KIBackendDatasourceImpl(dio: locator()));
print('Is registered: ' +
locator
.isRegistered(instance: locator<KIBackendDatasource>())
.toString());
locator.registerLazySingleton<AuthenticationRepository>(
() => AuthenticationRepositoryImpl(kiBackendDatasource: locator()));
locator.registerLazySingleton(() => GetUserDataUseCase(locator()));
locator.registerLazySingleton(() => AuthenticationBloc(
authenticationRepository: locator(),
userRepository: locator(),
getUserDataUseCase: locator()));
But when running the code the package throws an error that says:
Object/factory with type KIBackendDatasourceImpl 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?)
I have registered the KIBackendDatasourceImpl
. And even if I am checking the registration with:
locator
.isRegistered(instance: locator<KIBackendDatasource>())
It is returning true
.
So is there an issue or am I doing anything wrong here?
Metadata
Metadata
Assignees
Labels
No labels