isDarkTheme function

bool isDarkTheme(
  1. BuildContext context
)

First checks PlatformTheme then falls back to MediaQuery

Implementation

bool isDarkTheme(BuildContext context) =>
    PlatformTheme.of(context)?.isDark ??
    (MediaQuery.of(context).platformBrightness == Brightness.dark);