Skip to content

[go_router] Document when GoRouterState.name and path are null - #13486

Open
Alokxyz1112 wants to merge 2 commits into
flutter:mainfrom
Alokxyz1112:go-router-nullable-path-docs
Open

Alokxyz1112 wants to merge 2 commits into
flutter:mainfrom
Alokxyz1112:go-router-nullable-path-docs

Conversation

@Alokxyz1112

@Alokxyz1112 Alokxyz1112 commented Oct 29, 2026 •

Copy link
Copy Markdown

GoRouterState.name and GoRouterState.path are nullable, and the docs only said they can be null for the top level redirect, which left people guessing (see the issue). Going through every place that builds a GoRouterState, they are left null in:

  • RouteConfiguration.buildTopLevelGoRouterState, used for the top level GoRouter.redirect and onException
  • ShellRouteMatch.buildState, since a ShellRoute / StatefulShellRoute has no path of its own
  • RouteBuilder._buildErrorState, used for the error page

name is also null when the GoRoute just has no name. This updates both doc comments to list those cases. Added a pending changelog entry (patch).

Fixes flutter/flutter#121086

Pre-Review Checklist

Tests: exempt, this only changes doc comments.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If both you and the PR author believe this PR qualifies for a test exemption, escalate to the tech lead for the changed area to review and apply the test-exempt label. All reviewers should feel empowered to ask for tests before escalating.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation for GoRouterState.name and GoRouterState.path to clarify the specific scenarios in which these properties are null, and adds a corresponding changelog entry. The feedback suggests a grammatical correction to ensure proper subject-verb agreement in the updated documentation for GoRouterState.path.

Comment thread packages/go_router/lib/src/state.dart Outdated
Comment on lines +61 to +62
/// the state built for a [ShellRoute] or [StatefulShellRoute] (which have no
/// path of their own), and the state used for the error page.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrase 'a [ShellRoute] or [StatefulShellRoute]' is singular disjunctive, so the parenthetical clause should use singular verbs and pronouns ('has' and 'its') for proper subject-verb agreement.

Suggested change
/// the state built for a [ShellRoute] or [StatefulShellRoute] (which have no
/// path of their own), and the state used for the error page.
/// the state built for a [ShellRoute] or [StatefulShellRoute] (which has no
/// path of its own), and the state used for the error page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document why GoRouterState.path and GoRouterState.fullpath can be non

1 participant