onPopInvoked property
Called after a pop on the associated route was handled.
It's not possible to prevent the pop from happening at the time that this method is called; the pop has already happened. Use canPop to disable pops in advance.
This will still be called even when the pop is canceled. A pop is canceled
when the associated Route.popDisposition returns false, or when
canPop is set to false. The didPop parameter indicates whether or not
the back navigation actually happened successfully.
Implementation
@override
PopInvokedWithResultCallback<T> get onPopInvoked {
return (didPop, result) {
if (didPop) {
routeData.onPopInvoked(result);
final router = routeData.router;
// a workaround to fix pop flicker issue
// Todo: remove this workaround after flutter issue is fixed
// https://github.com/flutter/flutter/issues/178570
if (router is StackRouter) {
router.onPopPage(this);
}
}
};
}