window property

Window window

The window to which this binding is bound.

A number of additional bindings are defined as extensions of BindingBase, e.g., ServicesBinding, RendererBinding, and WidgetsBinding. Each of these bindings define behaviors that interact with a ui.Window, e.g., ServicesBinding registers a ui.Window.onPlatformMessage handler, and RendererBinding registers ui.Window.onMetricsChanged, ui.Window.onTextScaleFactorChanged, ui.Window.onSemanticsEnabledChanged, and ui.Window.onSemanticsAction handlers.

Each of these other bindings could individually access a Window statically, but that would preclude the ability to test these behaviors with a fake window for verification purposes. Therefore, BindingBase exposes this Window for use by other bindings. A subclass of BindingBase, such as TestWidgetsFlutterBinding, can override this accessor to return a different Window implementation, such as a TestWindow.


ui.Window get window => ui.window;