isDarkThemeProvider top-level property

Provider<bool> isDarkThemeProvider
final

Provider for checking if the current effective theme is dark (useful for conditional UI rendering)

Implementation

final isDarkThemeProvider = Provider<bool>((ref) {
  final themeMode = ref.watch(themeSwitcherProvider);

  if (themeMode == ThemeMode.dark) return true;
  if (themeMode == ThemeMode.light) return false;

  // For system theme, check the platform brightness
  return WidgetsBinding.instance.platformDispatcher.platformBrightness ==
      Brightness.dark;
});