getBool static method

bool getBool(
  1. String key, [
  2. bool defaultValue = false
])

Get the data as bool.

Specify the key of the value you want to get for key.

If the value does not exist in the specified key, the value of defaultValue will be returned.

Implementation

static bool getBool(String key, [bool defaultValue = false]) {
  if (!isInitialized) {
    debugPrint(
      "It has not been initialized. Please initialize it by executing [initialize()].",
    );
    return false;
  }
  if (!containsKey(key)) {
    return defaultValue;
  }
  return _preferences?.getBool(key) ?? defaultValue;
}