brightnessOf static method

Brightness brightnessOf(
  1. BuildContext context
)

Retrieves the Brightness to use for descendant Arna widgets, based on the value of ArnaThemeData.brightness in the given context.

If no ArnaTheme can be found in the given context, or its brightness is null, it will fall back to MediaQueryData.platformBrightness.

Throws an exception if no valid ArnaTheme or MediaQuery widgets exist in the ancestry tree.

See also:

Implementation

static Brightness brightnessOf(BuildContext context) {
  final _InheritedArnaTheme? inheritedTheme =
      context.dependOnInheritedWidgetOfExactType<_InheritedArnaTheme>();
  return inheritedTheme?.theme.data.brightness ??
      MediaQuery.of(context).platformBrightness;
}