tryGet<T> method

T? tryGet<T>(
  1. String key
)

Returns the stored value that has been associated with the specified key. Returns null if no value has been written.

Example:

var foo = req.store.tryGet<Foo>('foo');

Implementation

T? tryGet<T>(String key) {
  dynamic data = _data[key];
  assert(data == null || data is T,
      'Store value for key $key does not match type $T');
  return data as T?;
}