initializeTheme method
void
initializeTheme()
Method to initialize the app's theme
Implementation
void initializeTheme() async {
String? savedTheme = ProKitPrefManager.getString(
'theme'); // Get saved theme from SharedPreferences
/// Convert the saved theme string to ThemeMode enum, default to light if not found
ThemeMode? theme =
savedTheme.isEmpty ? ThemeMode.light : themeMap[savedTheme];
if (theme == null) {
/// If no valid theme found, default to light and save it
await ProKitPrefManager.setString(
'theme', ThemeMode.light.toString().split(".").last);
_themeMode = ThemeMode.light;
} else {
_themeMode = theme;
}
notifyListeners();
/// Notify listeners about the updated theme
}