launch static method

Future<bool> launch(
  1. String appToken, {
  2. AppRunCallback? appRunCallback,
  3. BugseeLaunchOptions? launchOptions,
})

Launch Bugsee

Implementation

static Future<bool> launch(String appToken,
    {AppRunCallback? appRunCallback,
    BugseeLaunchOptions? launchOptions}) async {
  bool launched = false;

  launchCallback() async {
    launched = await _initAndLaunch(appToken, launchOptions: launchOptions);
    _exceptionHandler?.installGlobalErrorHandler();
  }

  if (appRunCallback != null) {
    await runZonedGuarded<FutureOr<void>>(() async {
      // Make sure we've initialized all the internals
      await launchCallback();
      appRunCallback(launched);
    }, (error, stackTrace) async {
      await Bugsee.logHandledException(error, stackTrace);
    }, zoneSpecification: ZoneSpecification(
        print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
      parent.print(zone, line);
      Bugsee.log(line);
    }));
  } else {
    await launchCallback();
  }

  return Future.value(launched);
}