setThemeMode method

void setThemeMode(
  1. ThemeMode? value, [
  2. bool notify = true
])

Implementation

void setThemeMode(ThemeMode? value, [bool notify = true]) {
  // No work if null value passed.
  if (value == null) return;
  // Do not perform any work if new and old value are identical.
  if (value == _themeMode) return;
  // Otherwise, assign new value to private property.
  _themeMode = value;
  // Inform all listeners a change has occurred, if notify flag is true.
  if (notify) notifyListeners();
  // Persist the change to whatever storage is used with the ThemeService.
  unawaited(_themeService.save(Store.keyThemeMode, value));
}