injectable
injectable copied to clipboard
preResolved Future from module is initialized earlier than another preResolved dependency.
preResolved A(Module) depends on B(preResolved singleton, non-module). A is initialized earlier, than B.
Everything works fine, when A is defined as preresolved singleton, outside of module
@Milad-Akarie
We also have the same issue after updating to v1.5.2
Our module
@preResolve
@Singleton(dependsOn: [AppMiddleware])
Future<Store<AppState>> get store => AppStore.createStore();
Generated code:
v1.4.2
...
gh.lazySingleton<_i52.TabsMiddleware>(() => _i52.TabsMiddleware(
get<_i7.LoggerService>(), get<_i7.AppRouterService>()));
gh.lazySingleton<_i53.AuthService>(() => _i53.AuthService(
get<_i7.LoggerService>(), get<_i12.FlavorConfig>(), get<_i21.Client>()));
await gh.singletonAsync<_i7.Store<_i7.AppState>>( /// <------------ correct order
() => registerCoreDependencies.store,
dependsOn: [_i7.AppMiddleware],
preResolve: true);
return get;
v1.5.2
...
gh.lazySingleton<_i52.SleepTimerMiddleware>(
() => _i52.SleepTimerMiddleware(get<_i7.LoggerService>()));
await gh.singletonAsync<_i7.Store<_i7.AppState>>( /// <------------- incorrect order
() => registerCoreDependencies.store,
dependsOn: [_i7.AppMiddleware],
preResolve: true);
gh.lazySingleton<_i53.TabsMiddleware>(() => _i53.TabsMiddleware(
get<_i7.LoggerService>(), get<_i7.AppRouterService>()));
gh.lazySingleton<_i54.AuthService>(() => _i54.AuthService(
get<_i7.LoggerService>(), get<_i13.FlavorConfig>(), get<_i22.Client>()));
return get;
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions