barrierDismissible property Null safety

bool barrierDismissible
final

Whether you can dismiss this route by tapping the modal barrier.

The modal barrier is the scrim that is rendered behind each route, which generally prevents the user from interacting with the route below the current route, and normally partially obscures such routes.

For example, when a dialog is on the screen, the page below the dialog is usually darkened by the modal barrier.

If barrierDismissible is true, then tapping this barrier will cause the current route to be popped (see Navigator.pop) with null as the value.

If barrierDismissible is false, then tapping the barrier has no effect.

If this getter would ever start returning a different value, either changedInternalState or changedExternalState should be invoked so that the change can take effect.

It is safe to use navigator.context to look up inherited widgets here, because the Navigator calls changedExternalState whenever its dependencies change, and changedExternalState causes the modal barrier to rebuild.

See also:

  • barrierColor, which controls the color of the scrim for this route.
  • ModalBarrier, the widget that implements this feature.

Implementation

@override
final bool barrierDismissible;