@@ -87,6 +87,12 @@ class WindowManager {
8787 _listeners.remove (listener);
8888 }
8989
90+ double getDevicePixelRatio () {
91+ // Subsequent version, remove this deprecated member.
92+ // ignore: deprecated_member_use
93+ return window.devicePixelRatio;
94+ }
95+
9096 Future <void > ensureInitialized () async {
9197 await _channel.invokeMethod ('ensureInitialized' );
9298 }
@@ -289,7 +295,7 @@ class WindowManager {
289295 /// Returns `Rect` - The bounds of the window as Object.
290296 Future <Rect > getBounds () async {
291297 final Map <String , dynamic > arguments = {
292- 'devicePixelRatio' : window.devicePixelRatio ,
298+ 'devicePixelRatio' : getDevicePixelRatio () ,
293299 };
294300 final Map <dynamic , dynamic > resultData = await _channel.invokeMethod (
295301 'getBounds' ,
@@ -312,7 +318,7 @@ class WindowManager {
312318 bool animate = false ,
313319 }) async {
314320 final Map <String , dynamic > arguments = {
315- 'devicePixelRatio' : window.devicePixelRatio ,
321+ 'devicePixelRatio' : getDevicePixelRatio () ,
316322 'x' : bounds? .topLeft.dx ?? position? .dx,
317323 'y' : bounds? .topLeft.dy ?? position? .dy,
318324 'width' : bounds? .size.width ?? size? .width,
@@ -355,7 +361,7 @@ class WindowManager {
355361 /// Sets the minimum size of window to `width` and `height` .
356362 Future <void > setMinimumSize (Size size) async {
357363 final Map <String , dynamic > arguments = {
358- 'devicePixelRatio' : window.devicePixelRatio ,
364+ 'devicePixelRatio' : getDevicePixelRatio () ,
359365 'width' : size.width,
360366 'height' : size.height,
361367 };
@@ -365,7 +371,7 @@ class WindowManager {
365371 /// Sets the maximum size of window to `width` and `height` .
366372 Future <void > setMaximumSize (Size size) async {
367373 final Map <String , dynamic > arguments = {
368- 'devicePixelRatio' : window.devicePixelRatio ,
374+ 'devicePixelRatio' : getDevicePixelRatio () ,
369375 'width' : size.width,
370376 'height' : size.height,
371377 };
0 commit comments