loadSettings method

  1. @override
Future<void> loadSettings ()
override

Implementation

@override
Future<void> loadSettings() async {
  try {
    await Future.delayed(Duration(microseconds: 200));
    String themeTypeName = themeDb.get('type');
    ThemeType parsedThemeType = getThemeType(themeTypeName);
    if (parsedThemeType != null) {
      print('load theme settings with type ${parsedThemeType}');
      themeType = parsedThemeType;
    }
    bool useSystemSettings = themeDb.get('useSystem') != null
        ? themeDb.get('useSystem').toLowerCase() == 'true'
        : false;
    print('useSystemSettings: ${useSystemSettings}');
    useSystem = useSystemSettings;
    notifyListeners();
  } catch (err) {
    print('Error loading theme config');
    print('Reason: ' + err.toString());
    useSystem = false;
    themeType = ThemeType.WHITE;
    notifyListeners();
  }
}