MediaQueryData of(BuildContext context)

The data from the closest instance of this class that encloses the given context.

You can use this function to query the size an orientation of the screen. When that information changes, your widget will be scheduled to be rebuilt, keeping your widget up-to-date.

Typical usage is as follows:

MediaQueryData media = MediaQuery.of(context);

Source

static MediaQueryData of(BuildContext context) {
  MediaQuery query = context.inheritFromWidgetOfExactType(MediaQuery);
  return query?.data ?? new MediaQueryData.fromWindow(ui.window);
}