setActive method

Future<void> setActive()

Implementation

Future<void> setActive() async
{
  // wait for initialization to complete
  await initialized;

  // set current
  System.currentApp = this;

  // set active
  started = true;

  // reload the config?
  //_loadConfig();

  // start mirror
  if (mirrorApi != null && !FmlEngine.isWeb && scheme != "file") {
    Uri? uri = URI.parse(mirrorApi, domain: domain);
    if (uri != null) mirror = Mirror(uri.url)..execute();
  }

  // set credentials
  logon(jwt);

  // set stash values
  if (_stash != null)
  {
    for (var entry in _stash!.map.entries) {
      _stash!.scope?.setObservable(entry.key, entry.value);
    }
  }

  // start all datasources
  if (datasources != null) {
    for (var datasource in datasources!) {
      if (datasource.autoexecute != false) {
        datasource.start();
      }
      datasource.initialized = true;
    }
  }

  // set the theme
  if (context != null) {
    var notifier = Provider.of<ThemeNotifier>(context!, listen: false);
    notifier.setTheme(
        brightness: brightness,
        color: color,
        font: font);
  }
}