themeMode property Null safety

ThemeMode? themeMode
final

Determines which theme will be used by the application if both theme and darkTheme are provided.

If set to ThemeMode.system, the choice of which theme to use will be based on the user's system preferences. If the MediaQuery.platformBrightnessOf is Brightness.light, theme will be used. If it is Brightness.dark, darkTheme will be used (unless it is null, in which case theme will be used.

If set to ThemeMode.light the theme will always be used, regardless of the user's system preference.

If set to ThemeMode.dark the darkTheme will be used regardless of the user's system preference. If darkTheme is null then it will fallback to using theme.

The default value is ThemeMode.system.

See also:

  • theme, which is used when a light mode is selected.
  • darkTheme, which is used when a dark mode is selected.
  • ThemeData.brightness, which indicates to various parts of the system what kind of theme is being used.

Implementation

final ThemeMode? themeMode;