popDisposition property
override
Returns RoutePopDisposition.doNotPop if any of the PopEntry instances registered with registerPopEntry have PopEntry.canPopNotifier set to false.
Typically this method is not overridden because applications usually don't create modal routes directly, they use higher level primitives like showDialog. The scoped PopEntry list makes it possible for ModalRoute descendants to collectively define the value of popDisposition.
See also:
- Form, which provides an
onPopInvokedWithResult
callback that is similar. - registerPopEntry, which adds a PopEntry to the list this method checks.
- unregisterPopEntry, which removes a PopEntry from the list this method checks.
Implementation
@override
RoutePopDisposition get popDisposition {
for (final PopEntry<Object?> popEntry in _popEntries) {
if (!popEntry.canPopNotifier.value) {
return RoutePopDisposition.doNotPop;
}
}
return super.popDisposition;
}