json<T> method

CachedCall<T> json<T>(
  1. String key,
  2. Future<T> fetch()
)

Wraps a read whose answer is already JSON-shaped: maps, lists, strings, numbers, booleans and null, such as a decoded response body. T is what jsonDecode returns at the top, typically Map<String, Object?> or List<Object?>.

Implementation

CachedCall<T> json<T>(String key, Future<T> Function() fetch) =>
    call(key, fetch, codec: ApiCacheCodec.json<T>());