setValue method

Future<void> setValue(
  1. SharedPreferencesAsync prefs,
  2. T value
)

Saves a new value to SharedPreferences and updates the cache.

Updates the cache only if the save operation succeeds. Returns a Future<bool> indicating whether the operation was successful.

Implementation

Future<void> setValue(SharedPreferencesAsync prefs, T value) async {
  await _setter(prefs, key, value);
  _cachedValue = value;
}