clear method

Future<bool> clear()

Clears the entire key-value storage by removing all keys and values.

Notifies all active listeners that their keys got removed, which in turn makes them emit their respective defaultValue values.

Implementation

Future<bool> clear() async {
  final keys = _preferences.getKeys();
  final isSuccessful = await _preferences.clear();
  keys.forEach(_keyChanges.add);

  return isSuccessful;
}