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