getBool static method

bool getBool(
  1. String? key, [
  2. bool? defValue
])

Return false if key is null

Implementation

// ignore: avoid_positional_boolean_parameters
static bool getBool(String? key, [bool? defValue]) {
  if (key == null) {
    return false;
  }
  assert(_initCalled,
      'Prefs.init() must be called first in an initState() preferably!');
  assert(_prefsInstance != null,
      'Maybe call Prefs.getBoolF(key) instead. SharedPreferences not ready yet!');
  return _prefsInstance?.getBool(key) ?? defValue ?? false;
}