setTheme method
Set the app's theme and update preferences
Implementation
Future<void> setTheme({required ThemeMode theme}) async {
if (_themeMode != theme) {
_themeMode = theme;
/// Change the app theme
ProKitTheme.changeAppTheme(
themeType: _themeMode == ThemeMode.light ? ThemeType.light : ThemeType.dark);
/// Save the new theme to preferences
await ProKitPrefManager.setString('theme', theme.toString().split('.').last);
notifyListeners(); /// Only notify listeners after all updates
}
}