getWindowSize property

  1. @override
Future<Size> get getWindowSize
override

getWindowSize Get the window size.

Implementation

@override
Future<Size> get getWindowSize async {
  // final out = await methodChannel.invokeMethod(getWindowSizeMethod);
  // final result = Map<String, double>.from(out);

  // final width = result['width'] ?? 0.0;
  // final height = result['height'] ?? 0.0;

  // return Size(width, height);

  final result = Map<String, double>.from(
    await methodChannel.invokeMethod(getWindowSizeMethod, <String, dynamic>{
      'dpr': PlatformDispatcher.instance.implicitView?.devicePixelRatio ?? 1.0,
    }),
  );
  final width = result['width'] ?? 0.0;
  final height = result['height'] ?? 0.0;
  return Size(width, height);
}