onClose property

VoidCallback? onClose
final

Called when the menu overlay is hidden.

When MenuController.close is called, onCloseRequested is invoked with a hideOverlay callback that, when called, hides the menu overlay and triggers onClose.

The default implementation of onCloseRequested calls hideOverlay synchronously, thereby calling onClose synchronously. In this case, onClose is called regardless of whether the menu overlay is already hidden.

Custom implementations of onCloseRequested can delay the call to hideOverlay or not call it at all, in which case onClose will not be called. Calling hideOverlay after disposal is a no-op, and will not trigger onClose.

Implementation

final VoidCallback? onClose;