Skip to content

Conversation

@bizz84
Copy link
Owner

@bizz84 bizz84 commented Jan 11, 2025

This PR shows how to add a NavigatorObserver to GoRouter-based apps.

Unfortunately, adding observers: [AppRouterObserver()] is not enough and all route names will be null, unless an explicit name is added inside the pageBuilder:

GoRoute(
  path: '/jobs',
  name: AppRoute.jobs.name,
  pageBuilder: (context, state) => NoTransitionPage(
    // without this, the NavigatorObserver will report route name == null
    name: AppRoute.jobs.name,
    child: JobsScreen(),
  ),
)

But there are still cases where it doesn't work reliably.
See this issue for more details:
flutter/flutter#112185

@bizz84
Copy link
Owner Author

bizz84 commented May 8, 2025

Replaced by #162.

@bizz84 bizz84 closed this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants