Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/release/breaking-changes/android-predictive-back.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,41 @@ if (_route.popDisposition == RoutePopDisposition.doNotPop) {
}
```

### Migrating a back confirmation dialog
WillPopScope was sometimes used to show a confirmation dialog when a back
gesture was received. This can still be done with PopScope in a similar pattern.

Code before migration:

```dart
WillPopScope(
onWillPop: () async {
final bool? shouldPop = await _showBackDialog();
return shouldPop ?? false;
},
child: child,
)
```

Code after migration:

```dart
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
if (didPop) {
return;
}
final NavigatorState navigator = Navigator.of(context);
final bool? shouldPop = await _showBackDialog();
if (shouldPop ?? false) {
navigator.pop();
}
},
child: child,
)
```

## Timeline

Landed in version: 3.13<br>
Expand Down