runApp function

void runApp(
  1. String appId,
  2. Widget app, {
  3. bool setupMetaSEO = true,
})

Initializes and runs an Arcane app.

This function sets up required Arcane components before launching the app:

  • Sets up debug utilities
  • Loads all shaders
  • Configures SEO for web applications

For more details, see the ArcaneApp documentation.

@param app The widget to run as the root of the widget tree @param setupMetaSEO Whether to configure SEO metadata for web applications

Implementation

void runApp(String appId, Widget app, {bool setupMetaSEO = true}) async {
  $appId = appId;
  setupArcaneDebug();
  $registerInitTask(InitTask("Arcane Haptics",
      () => Haptics.canVibrate().then((i) => kHapticsAvailable = i)));
  $registerInitTask(InitTask("Arcane Hive", () async {
    await Hive.initFlutter(appId);
    await Future.wait([
      Hive.openBox(
        "$appId.hb",
        encryptionCipher: HiveAesCipher(
          Random("$appId.hb".hashCode ^ 0x33EF69DF3D9).nextInts(32),
        ),
      ).then((box) => hotBox = box),
      Hive.openLazyBox(
        "$appId.cb",
        encryptionCipher: HiveAesCipher(
          Random("$appId.cb".hashCode ^ 0x73DE39333A).nextInts(32),
        ),
      ).then((box) => coldBox = box),
    ]);
  }));
  $registerInitTask(
      InitTask("Arcane Shaders", () async => ArcaneShader.loadAll()));

  if (kIsWeb) {
    if (setupMetaSEO) {
      $registerInitTask(InitTask("Meta SEO", () async {
        try {
          MetaSEO().config();
          actioned("SEO Engine Configured for Browser");
        } catch (e) {}
      }));
    }
  }

  MagicInitializer.getInitializers(app).forEach($registerInitTask);
  await $executeInitTasks();
  await services().waitForStartup();
  $shadEvent = ArcaneShadEvents();
  m.runApp(app);
}