Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppRouteObserver and route name to all pageBuilders #160

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

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 bizz84 marked this pull request as draft January 17, 2025 11:08
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.

1 participant