refresh method
Triggers notifyListeners after a zero-duration delay. Returns a
Future that completes once the notify has been scheduled and
(potentially) fired — callers that need to read post-notify state
can await it.
Safe to call right before dispose; the scheduled tick is a no-op once isDisposed flips true.
Implementation
@override
Future<void> refresh({bool notifyImmediately = true}) {
return _enqueue(() async {
_sharedPreferences ??= await _getPrefs();
final v = _sharedPreferences!.get(key);
final newValue = fromValue(v is B ? v : null);
_set(newValue, notifyImmediately: notifyImmediately);
});
}