install static method

void install()

Idempotent install. Safe to call multiple times within the same isolate lifetime. Hot-restart resets the counter naturally (statics re-run their initializers); the second real install completes fresh.

Implementation

static void install() {
  final disable = aiTestDisableEnvValue.toLowerCase().trim();
  if (disable == '1' || disable == 'true' || disable == 'yes') {
    developer.log(
      '[fluttersdk_dusk] install() skipped — DUSK_DISABLE=$aiTestDisableEnvValue set.',
      name: 'dusk',
    );
    return;
  }
  if (_installCount > 0) {
    developer.log(
      '[fluttersdk_dusk] install() called ${_installCount + 1} times — '
      'skipping duplicate.',
      name: 'dusk',
    );
    _installCount++;
    return;
  }
  _installCount++;

  // Force Semantics tree on for snapshot extension.
  _semanticsHandle ??= RendererBinding.instance.ensureSemantics();

  // Register all ext.dusk.* extensions.
  registerAllDuskExtensions();

  developer.log(
    '[fluttersdk_dusk] installed (kDebugMode=$kDebugMode, isWeb=$kIsWeb)',
    name: 'dusk',
  );
}