physicalSize property

Size physicalSize

The dimensions of the rectangle into which the scene rendered in this view will be drawn on the screen, in physical pixels.

When this changes, PlatformDispatcher.onMetricsChanged is called. When using the Flutter framework, using MediaQuery.of to obtain the size (via MediaQueryData.size), instead of directly obtaining the physicalSize from a FlutterView, will automatically cause any widgets dependent on the size to rebuild when the size changes, without having to listen to PlatformDispatcher.onMetricsChanged.

At startup, the size of the view may not be known before Dart code runs. If this value is observed early in the application lifecycle, it may report Size.zero.

This value does not take into account any on-screen keyboards or other system UI. The padding and viewInsets properties provide information about how much of each side of the view may be obscured by system UI.

This value is the same as the size member of physicalGeometry.

See also:

Implementation

Size get physicalSize => _viewConfiguration.geometry.size;