getString method
Implementation
String getString(String key, {String defaultValue = ''}) {
if (_config.type == StorageType.sharedPreferences) {
final encKey = _encryptKey(key);
final encValue = _prefs!.getString(encKey);
if (encValue == null) return defaultValue;
try {
return _decryptValue(encValue);
} catch (e) {
debugPrint('Decryption failed for key: $key');
return defaultValue;
}
} else {
return _hiveBox!.get(key, defaultValue: defaultValue) as String? ??
defaultValue;
}
}