getOrSetDefaultAsync<V> method

Future<V?> getOrSetDefaultAsync<V>(
  1. String key,
  2. dynamic defaultValue
)

Gets key value. If absent sets the key to defaultValue and returns it.

Implementation

Future<V?> getOrSetDefaultAsync<V>(String key, dynamic defaultValue) async {
  if (isLoaded) return getOrSetDefault<V>(key, defaultValue);
  return _callLoaded<V?>(() => getOrSetDefault<V>(key, defaultValue));
}