resetToSharedPrefsValues method
void
resetToSharedPrefsValues()
Resets the dark mode flag and color to the ones that are saved in shared preferences.
This triggers a rebuild of the widgets utilizing the DynamicColorTheme
.
Implementation
void resetToSharedPrefsValues() {
Future<Color> colorFuture = loadColor();
Future<bool> isDarkFuture = loadIsDark();
Future.wait([colorFuture, isDarkFuture]).then((List results) {
_color = results[0];
_isDark = results[1];
setState(() {
_data = widget.data(_color, _isDark);
});
});
}