getAndPut method Null safety

  1. @override
Future<T?> getAndPut(
  1. String key,
  2. T value,
  3. {CacheEntryDelegate<T>? delegate}

Associates the specified value with the specified key in this cache, returning an existing value if one existed. If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

  • key: key with which the specified value is to be associated
  • value: value to be associated with the specified key
  • delegate: provides the caller a way of changing the CacheEntry before persistence

The previous value is returned, or null if there was no value associated with the key previously.


Future<T?> getAndPut(String key, T value, {CacheEntryDelegate<T>? delegate});