preventWindowClosure static method

Future<void> preventWindowClosure()

Prevents the window from being closed by the user.

Requires the window delegate to be enabled.

The window will still be closable programmatically by calling closeWindow.

Implementation

static Future<void> preventWindowClosure() async {
  await _completer.future;
  final hasSucceeded = await _windowManipulatorMethodChannel
      .invokeMethod('preventWindowClosure');

  assert(
      hasSucceeded,
      'preventWindowClosure failed. Please make sure that '
      'the `enableWindowDelegate` parameter is set to true in your '
      'WindowManipulator.initialize call.');
}