watchBool static method

PreferenceNotifier<bool> watchBool(
  1. Ref<Object?> ref,
  2. String key, {
  3. required bool defaultValue,
})

Preference notifier that starts with the current bool value for the given key, then emits a new value every time there are chanegs to the value associated with the given key.

Implementation

static PreferenceNotifier<bool> watchBool(
  Ref ref,
  String key, {
  required bool defaultValue,
}) {
  return SharedPreferenceNotifier._(
    ref,
    (sharedPref) => sharedPref.getBool(key, defaultValue: defaultValue),
    defaultValue,
  );
}