getValue method

Future<T?> getValue(
  1. SharedPreferencesAsync prefs
)

Gets the value from SharedPreferences.

If the value doesn't exist and defaultValue is provided, stores the default value and returns it.

Implementation

Future<T?> getValue(SharedPreferencesAsync prefs) async {
  final exists = await _exists(prefs);
  if (!exists && defaultValue != null) {
    await setValue(prefs, defaultValue as T);
    return defaultValue;
  }
  return await adapter.getter(prefs, key);
}