read method

Future<T?> read(
  1. String key, {
  2. ETagReceiver? eTagReceiver,
})

Read the entry with the given key from the store.

If an entry exists for key, the deserialized value will be returned. If it does not exists, null is returned instead.

If eTagReceiver was specified, it will contain the current eTag of the read entry after the returned future was resolved.

Implementation

Future<T?> read(String key, {ETagReceiver? eTagReceiver}) async {
  final response = await restApi.get(
    path: _buildPath(key),
    eTag: eTagReceiver != null,
  );
  _applyETag(eTagReceiver, response);
  return response.data != null ? dataFromJson(response.data) : null;
}