Skip to content

Preserve WillPopScope as an alternate for PopScope #138614

@AndreiMisiukevich

Description

@AndreiMisiukevich

Is there an existing issue for this?

Use case

In our case, we want to present confirmation dialogs when the user wants to close the page and WillPopScope works like a charm in this scenario.

Yes, we can set canPop: false and write dialogue prompting logic inside onPopInvoked, but it doesn't solve the problem because the result of NavigatorState.maybePop will be returned before the user answers to dialog.

Also, popDisposition is sync, while willPop is async. This makes prompting a dialogue impossible.

Proposal

Is there any chance the decision about deprecating WillPopScope will be revisited?

My team finds PopScope inconvenient in comparison to WillPopScope.

While WillPopScope allows to intercept the pop-action intent, the PopScope doesn't. Instead, PopScope proposes to handle the result of this action.

UPD:
We have worked around this by writing a custom maybePop method.
But I still think WillPopScope can live together with PopScope

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: routesNavigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions