themeIsDark static method

bool? themeIsDark(
  1. BuildContext context
)

Whether the theme itself is dark, or null when the theme sets no brightness and follows the system.

For native modals: a style set when one opens stays until it closes, so a modal that should follow the system gets none.

Implementation

static bool? themeIsDark(BuildContext context) {
  final brightness = CupertinoTheme.of(context).brightness;
  return brightness == null ? null : brightness == Brightness.dark;
}