isDarkMode property
bool
get
isDarkMode
Example if (context.isDarkMode) { do something here... }
Implementation
bool get isDarkMode {
final brightness = MediaQuery.of(this).platformBrightness;
return brightness == Brightness.dark;
}