ensureInitialized static method

Future<void> ensureInitialized(
  1. int windowId
)

Ensure the window manager for this windowId is initialized. Must be called before accessing the WindowManagerPlus.current.

Implementation

static Future<void> ensureInitialized(int windowId) async {
  if (_current != null) {
    return;
  }
  final Map<String, dynamic> arguments = {
    'windowId': windowId,
  };
  // temp method channel to ensure initialized
  final MethodChannel _channel = const MethodChannel('window_manager_plus');
  await _channel.invokeMethod('ensureInitialized', arguments);
  _current = WindowManagerPlus._(windowId);
}