setBounds method

Future<void> setBounds(
  1. Rect? bounds, {
  2. Offset? position,
  3. Size? size,
  4. bool animate = false,
})

Resizes and moves the window to the supplied bounds.

Implementation

Future<void> setBounds(
  Rect? bounds, {
  Offset? position,
  Size? size,
  bool animate = false,
}) async {
  final Map<String, dynamic> arguments = {
    'devicePixelRatio': getDevicePixelRatio(),
    'x': bounds?.topLeft.dx ?? position?.dx,
    'y': bounds?.topLeft.dy ?? position?.dy,
    'width': bounds?.size.width ?? size?.width,
    'height': bounds?.size.height ?? size?.height,
    'animate': animate,
  }..removeWhere((key, value) => value == null);
  await _channel.invokeMethod('setBounds', arguments);
}