ensureInitialized<O> method
Helper function that runs given block after async initialization is completed.
Implementation
Future<O> ensureInitialized<O>(Future<O> Function() block) async {
await initializationCompleter.future;
return block();
}