Skip to content

[go_router] Replace redirect with onEnter and onExit #102408

@johnpryan

Description

@johnpryan

In order to better support redirection, we should replace the redirection API with onEnter and onExit.

The onEnter function is called when the new location results in a RouteMatch that was not previously present on RouteMatchList:

matchList = [ "/a"]
matchList' = [ "/a", "b"]

When matchList changes to matchList', the onEnter callback for Route "b" will be called, and the callback for "/a" will not.

The onExit callback is invoked when the reverse is true:

matchList = [ "/a", "b"]
matchList' = [ "/a"]

When matchList changes to matchList', the onExit callback for Route "b" will be called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilitycustomer: crowdAffects or could affect many people, though not necessarily a specific customer.p: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions