exampleMainComposite function

void exampleMainComposite()

main() — pass the OR'd config flags across the children you compose (the flags live on ErrorReportingConfig, not on the individual reporters — ERH-007). Any Firebase-dependent child ⇒ requiresFirebase: true; any child that manages its own handlers ⇒ managesOwnErrorHandlers: true. (A Sentry + Crashlytics composite where dreamic owns the handlers ⇒ requiresFirebase: true, managesOwnErrorHandlers: false.)

Implementation

void exampleMainComposite() async {
  /*
  // ensureInitialized() is the FIRST line INSIDE the guarded zone — the SAME zone
  // as runApp — or Flutter logs a "Zone mismatch" warning (runGuarded forks a child
  // runZonedGuarded zone). Use `() async { ... }` if your pre-runApp setup needs an
  // `await`.
  DreamicErrorHandling.runGuarded(() {
    WidgetsFlutterBinding.ensureInitialized();
    installEarlyErrorHandlers();
    if (kWebDartCapture) {
      DreamicErrorHandling.installEarlyWebErrorHandlers(); // Path A′ only
    }

    configureErrorReporting(
      ErrorReportingConfig.customOnly(
        reporter: CompositeErrorReporter([
          SentryErrorReporter(dsn: AppConfig.sentryDsn),
          CrashlyticsErrorReporter(),
        ]),
        enableOnWeb: true,       // Sentry is web-capable; Crashlytics self-guards web
        requiresFirebase: true,  // OR'd: Crashlytics needs Firebase first
        // managesOwnErrorHandlers: false → dreamic installs the handlers.
      ),
    );

    runApp(DreamicAppInitHost(
      initFutureFactory: () => dreamicBootstrap(/* firebaseOptions, hooks, ... */),
      splash: const DreamicSplash(),
      child: const MyApp(),
    ));
  });
  */
  // Reference the primitive so the import is exercised in dreamic-public.
  CompositeErrorReporter; // ignore: unnecessary_statements
}