ensureTestAnalyticsProvider function
void
ensureTestAnalyticsProvider()
Replaces the application's analytics provider with a no-op widget-test provider after app module bootstrap and before test screens are launched.
Implementation
void ensureTestAnalyticsProvider() {
// App module bootstraps register their production analytics provider before
// this hook. Widget tests have no native analytics host and use simulated
// Firebase app IDs, so replace it at the runner boundary before the app is
// launched. This keeps test-only analytics configuration out of app code.
if (GetIt.I.isRegistered<LogProvider>()) {
GetIt.I.unregister<LogProvider>();
}
GetIt.I.registerSingleton<LogProvider>(_TestLogProvider());
}