♻️ Adjust the firebase analytics observer guard
This commit is contained in:
@@ -71,22 +71,23 @@ Widget _tabPagesTransitionBuilder(
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get _supportsAnalytics =>
|
bool get _supportsAnalytics =>
|
||||||
kIsWeb || Platform.isAndroid || Platform.isIOS;
|
kIsWeb ||
|
||||||
|
Platform.isAndroid ||
|
||||||
|
Platform.isIOS ||
|
||||||
|
Platform.isMacOS ||
|
||||||
|
Platform.isWindows;
|
||||||
|
|
||||||
// Provider for the router
|
// Provider for the router
|
||||||
final routerProvider = Provider<GoRouter>((ref) {
|
final routerProvider = Provider<GoRouter>((ref) {
|
||||||
final observers = <NavigatorObserver>[];
|
|
||||||
|
|
||||||
if (_supportsAnalytics) {
|
|
||||||
final analytics = FirebaseAnalytics.instance;
|
|
||||||
observers.add(FirebaseAnalyticsObserver(analytics: analytics));
|
|
||||||
}
|
|
||||||
|
|
||||||
return GoRouter(
|
return GoRouter(
|
||||||
navigatorKey: rootNavigatorKey,
|
navigatorKey: rootNavigatorKey,
|
||||||
initialLocation: '/',
|
initialLocation: '/',
|
||||||
observers: observers,
|
observers: [
|
||||||
|
if (_supportsAnalytics)
|
||||||
|
FirebaseAnalyticsObserver(analytics: FirebaseAnalytics.instance),
|
||||||
|
],
|
||||||
routes: [
|
routes: [
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
navigatorKey: _shellNavigatorKey,
|
navigatorKey: _shellNavigatorKey,
|
||||||
|
Reference in New Issue
Block a user