fromWindow method Null safety

Widget fromWindow(
  1. {Key? key,
  2. required Widget child}

Provides a MediaQuery which is built and updated using the latest WidgetsBinding.window values.

The MediaQuery is wrapped in a separate widget to ensure that only it and its dependents are updated when window changes, instead of rebuilding the whole widget tree.

This should be inserted into the widget tree when the MediaQuery view padding is consumed by a widget in such a way that the view padding is no longer exposed to the widget's descendants or siblings.

The child argument is required and must not be null.


static Widget fromWindow({
  Key? key,
  required Widget child,
}) {
  return _MediaQueryFromWindow(
    key: key,
    child: child,