themeIsDark static method
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;
}