onReady method

Future<void> onReady()

A future that completes when the factory has finished its asynchronous initialization.

If initAsync was provided to Control.initControl or initialize, this future will complete after initAsync has finished. If the factory is already initialized, the future completes immediately.

This is useful to ensure that all services are ready before starting the application logic.

await Control.factory.onReady();
runApp(MyApp());

Implementation

Future<void> onReady() async {
  if (_completer.isCompleted) {
    return;
  }

  return _completer.future;
}