initialize method

Future<void> initialize()

Implementation

Future<void> initialize() async {

  // wait for system apps to load
  await System.appsLoaded.future;

  // get splash delay
  delay = System.currentApp?.splashDuration ?? (System.currentApp?.splash == null ? 0 : defaultDelay);

  // skip the splash image
  if (delay <= 0) {

    // wait for the system to initialize
    await System.initialized.future;

    // launch engine
    return onInitializationComplete.call();
  }

  // signal default app loaded
  initialized.complete(true);

  // wait for the system to initialize
  await System.initialized.future;

  // show the splash logo for specified delay?
  await Future.delayed(Duration(seconds: min(delay,maxDelay)));

  // done
  onInitializationComplete.call();
}