setPreventClose method

Future<void> setPreventClose(
  1. bool isPreventClose
)

Set if intercept the native close signal. May useful when combine with the onclose event listener.

The title bar's close button and close then report onWindowClose and leave the window open; destroy still closes it.

Implementation

Future<void> setPreventClose(bool isPreventClose) async {
  _isPreventClose = isPreventClose;
  if (isPreventClose) {
    _wireNativeEvents();
  } else if (_listeners.isEmpty) {
    _unwireNativeEvents();
  }
}