onPopInvoked property

(void Function(bool)?) onPopInvoked
final

Called after a route pop was handled.

Even when the pop is canceled, for example by a PopScope widget, this will still be called. The didPop parameter indicates whether or not the back navigation actually happened successfully.

{@tool dartpad} This sample demonstrates how to use this parameter to show a confirmation dialog when a navigation pop would cause form data to be lost.

** See code in examples/api/lib/widgets/form/form.1.dart ** {@end-tool}

See also:

  • canPop, which also comes from PopScope and is often used in conjunction with this parameter.
  • PopScope.onPopInvoked, which is what Form delegates to internally.ther widget that provides a way to intercept the back button.

Implementation

final void Function(bool)? onPopInvoked;