updateThemeMode method
Update and persist the ThemeMode based on the user's selection.
Implementation
Future<void> updateThemeMode(ThemeMode? newThemeMode) async {
if (newThemeMode == null) return;
// Dot not perform any work if new and old ThemeMode are identical
//if (newThemeMode == _themeMode) return;
// Otherwise, store the new theme mode in memory
_themeMode = newThemeMode;
// Important! Inform listeners a change has occurred.
notifyListeners();
// Persist the changes to a local database or the internet using the
// SettingService.
await _settingsService.updateThemeMode(newThemeMode);
}