resolveAttachErrorReportingFirst function
Resolves whether to attach the error reporter BEFORE Firebase init.
explicitOverride wins when an app passes one to dreamicBootstrap.
Otherwise (null) dreamic derives a great default from the configured
errorReportingConfig: a self-contained reporter (e.g. Sentry) needs no
Firebase, so it SHOULD attach as early as possible (step 0) to catch the most
startup errors; a Firebase-dependent reporter (e.g. Crashlytics, declared via
reporterRequiresFirebase: true) must attach at the post-Firebase step.
Hence: attach early iff there is a reporter that does NOT require Firebase.
Reads errorReportingConfig, so configureErrorReporting(...) must run
before dreamicBootstrap (the canonical pre-runApp main() line). When
nothing is configured there is no reporter, so the derivation yields false
(no early attach).
Implementation
@visibleForTesting
bool resolveAttachErrorReportingFirst(bool? explicitOverride) {
if (explicitOverride != null) return explicitOverride;
final config = errorReportingConfig;
return config.customReporter != null && !config.reporterRequiresFirebase;
}