switchTheme method Null safety

void switchTheme(
  1. bool? dark
)

Implementation

void switchTheme(bool? dark) async {
  if (dark == null) {
    _themeMode = ThemeMode.system;
  } else {
    _themeMode = dark == true ? ThemeMode.dark : ThemeMode.light;
  }
  notifyListeners();
}