platformBrightnessOf static method

Brightness platformBrightnessOf(
  1. BuildContext context
)

Returns MediaQueryData.platformBrightness for the nearest MediaQuery ancestor or Brightness.light, if no such ancestor exists.

Use of this method will cause the given context to rebuild any time that the MediaQueryData.platformBrightness property of the ancestor MediaQuery changes.

Prefer using this function over getting the attribute directly from the MediaQueryData returned from of, because using this function will only rebuild the context when this specific attribute changes, not when any attribute changes.

Implementation

static Brightness platformBrightnessOf(BuildContext context) => maybePlatformBrightnessOf(context) ?? Brightness.light;