onBackPressed property

OnBackPressedCallback? onBackPressed
final

返回按钮点击回调。当用户按下返回键时调用。 如果返回 true,表示已处理返回事件,不再执行默认行为。 如果返回 false 或 null,且当前不是全屏状态,将执行默认行为(Navigator.pop)。

Back button press callback. Called when the user presses the back button. Returns true to indicate the back event was handled and no default action is needed. Returns false or null to allow default behavior (Navigator.pop) if not in fullscreen mode.

Implementation

final OnBackPressedCallback? onBackPressed;