create method

  1. @override
Future<int> create({
  1. bool createChildren = true,
})
override

Creates this Window.

Implementation

@override
Future<int> create({bool createChildren = true}) async {
  await ensureLoaded();

  final createIdPtr = calloc<Uint32>();
  createIdPtr.value = _createId;

  final hwnd = createWindowImpl(createIdPtr);

  if (hwnd == 0) {
    var errorCode = GetLastError();
    throw StateError("Can't create window> errorCode: $errorCode -> $this");
  }

  if (_hwnd != null && _hwnd != hwnd) {
    throw StateError(
        "`WM_CREATE` `Window` lookup error: _hwnd:$_hwnd != hwnd:$hwnd");
  }

  _hwnd = hwnd;

  _logWindow.info(() => "Created Window #$hwnd: $this");

  if (createChildren) {
    for (var c in _children) {
      await c.create();
    }
  }

  return hwnd;
}