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