Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[go_router_builder] Allow users to specify onExit as optional #183099

@hantrungkien

Description

@hantrungkien

Use Case

I'm using go_router_builder and have three routes

HomeRouteData, Details1RouteData, and Details2RouteData, corresponding to HomePage, Details1Page, and Details2Page.

On HomePage, I push Details1Page and wait for a returned result. here
On Details1Page, I push Details2Page and wait for a result. here
On Details2Page, I pop to return to Details1Page. here
At that point, I continue to pop to go back to HomePage from Details1Page, but I can’t. here

After investigating the root cause, I found that the issue is due to the onExit callback always being passed into the GoRoute constructor.

Proposal

Use a variable similar to caseSensitive to determine whether this route implements the onExit callback.

  const TypedGoRoute({
    required this.path,
    this.name,
    this.routes = const <TypedRoute<RouteData>>[],
    this.caseSensitive = true,
    this.overrideOnExit = false,
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions