PrfBool constructor

PrfBool(
  1. String key, {
  2. bool? defaultValue,
})

Creates a new boolean preference variable with the specified key.

The optional defaultValue is returned if the preference is not found or if an error occurs while reading.

Implementation

PrfBool(String key, {bool? defaultValue})
    : super(
        key,
        (prefs, key) async => await prefs.getBool(key),
        (prefs, key, value) async => await prefs.setBool(key, value),
        defaultValue,
      );