Skip to content

getIt.allReady() never call #236

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

Closed
ThanhPhungTien opened this issue Dec 14, 2021 · 1 comment
Closed

getIt.allReady() never call #236

ThanhPhungTien opened this issue Dec 14, 2021 · 1 comment

Comments

@ThanhPhungTien
Copy link

Hi,
I register the Singleton as follows but GetIt.allready(); never call. Application stuck at log 6.
Please help.

Future<void> configureDependencies() async {
  final GetIt getIt = GetIt.instance;
  log('1');
  SharedPreferences prefs = await SharedPreferences.getInstance();

  getIt.registerSingletonAsync<SharedPreferences>(
    () async => prefs,
    signalsReady: true,
  );
  log('2');
  getIt.registerSingletonAsync(
    () async => APIHandler(),
    dependsOn: [SharedPreferences],
    signalsReady: true,
  );
  //Storage
  log('3');
  getIt.registerSingletonAsync(
    () async => UserStorage(),
    dependsOn: [SharedPreferences],
    signalsReady: true,
  );
  log('4');
  getIt.registerSingletonAsync(
    () async => SessionStorage(),
    dependsOn: [SharedPreferences],
    signalsReady: true,
  );
  log('5');
  //Repository
  getIt.registerSingletonAsync(
    () async => UserRepository(),
    dependsOn: [SharedPreferences],
    signalsReady: true,
  );
  log('6');
  await getIt.allReady();
  log('7');
}
@ThanhPhungTien
Copy link
Author

Change signalsReady to false solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant