Skip to content

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

Closed
flutter/packages
#13486

Description

@momrak

On the GoRouterState class we can see the following properties:

fullpath → String?
path → String?
location → String
subloc → String

I am wondering why the path properties are nullable while the location ones are not? In which cases can fullpath and path be null?

Activity

  1. added
    in triage
    on Feb 20, 2023
  2. exaby73 commented on Feb 20, 2023

    @exaby73
    Member

    Hello @momrak. Taking a quick look through the code, doesn't look like path has to be nullable. Though this is a very brief look and is non-conclusive to say the least. Here's a place where path is definitely not null. GoRoute.path is non-nullable so makes sense that path in GoRouterState can be non-nullable too. Same could apply for fullpath.

    As I mentioned, my searching is non-conclusive so take this with a grain of salt. Labelling this issue for further insights from the team

    https://github.com/flutter/packages/blob/a162a98cff4dd14bb4e21ed512b42558bb38d953/packages/go_router/lib/src/builder.dart#L260

  3. changed the title [-][GoRouter] Question: nullable fullpath and path vs non-nullable subloc and location[/-] [+]Make `GoRouterState.path` and `GoRouterState.fullpath` non-nullable[/+] on Feb 20, 2023
  4. added
    package
    c: proposal
    p: go_router
    and removed
    in triage
    on Feb 20, 2023
  5. added
    P3
    on Feb 21, 2023
  6. chunhtai commented on Feb 23, 2023

    @chunhtai
    Contributor

    It can be null when the corresponding Route is a ShellRoute

  7. momrak commented on Feb 27, 2023

    @momrak
    Author

    @chunhtai shouldn't this be documented somewhere? Seeing these fields being nullable but not knowing when I need to guard against is not a good feeling when building an app...

    I also still don't quite get what you mean by It can be null when the corresponding Route is a ShellRoute. I have never seen fullpath being null. Path is empty string when i try printing it from a ShellRoute pagebuilder, but fullpath still has content. And as a shellroute does not have an explicit location this comment does not really clear things up for me.

    So my suggestions is to properly document the behavior on these fields.

  8. changed the title [-]Make `GoRouterState.path` and `GoRouterState.fullpath` non-nullable[/-] [+]Document why `GoRouterState.path` and `GoRouterState.fullpath` can be non[/+] on Feb 27, 2023
  9. 3 remaining items

  10. added
    team-framework
    triaged-framework
    and removed on Jun 5, 2025
  11. added
    team-ecosystem
    triaged-ecosystem
    and removed
    team-framework
    triaged-framework
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3d: api docsp: go_routerpackageteam-ecosystemtriaged-ecosystem

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions