getInt method
- String key
Retrieves an integer value from SharedPreferences.
Returns the default value if the key does not exist.
key: The key for the integer value to be retrieved.
Implementation
Future<int> getInt(String key) async {
await ensureSharedPrefIsInitialized();
if (intKeys.containsKey(key)) {
return prefs.getInt(key) ?? intKeys[key]!;
} else {
throw Exception("Key '$key' is not implemented as int.");
}
}