Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter 3.10 - 'window' is deprecated and shouldn't be used

Tags:

flutter

dart

I am looking at the documentation and apparently I can use platformDispatcher to get some data, however I can`t seem to get the following attributes :

ui.window.devicePixelRatio
ui.window.physicalSize
ui.window.viewPadding

Any idea where I can get without using a context ?

like image 303
Daniel Roldán Avatar asked Nov 30 '25 21:11

Daniel Roldán


2 Answers

WidgetsBinding.instance.platformDispatcher.views.first.physicalSize work for me. you can also try PlatformDispatcher.instance.views.first.physicalSize

like image 137
user3087360 Avatar answered Dec 03 '25 15:12

user3087360


You can use View.of(context) to get physicalSize, devicePixelRatio and viewPadding

like image 35
laila nabil Avatar answered Dec 03 '25 15:12

laila nabil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!