addAutomaticInApp method

void addAutomaticInApp()

Doesn't work as integration, because it's run in another zone, so no access to the original main function.

Implementation

void addAutomaticInApp() {
  try {
    final stackTrace = Trace.current();
    final package = stackTrace.frames.firstWhere(_notSentryLibrary).package;
    if (package != null) {
      addInAppInclude(package);
      considerInAppFramesByDefault = false;
    } else {
      logger(
        SentryLevel.debug,
        "Couldn't read default package name",
      );
    }
  } catch (e, stackTrace) {
    logger(
      SentryLevel.debug,
      "Couldn't read default package name",
      exception: e,
      stackTrace: stackTrace,
    );
  }
}