getJSON method

Future getJSON(
  1. String key
)

get JSON value for key.

stored JSON string is converted to dynamic using json.decode. if cache entry is expired or not found, returns null.

Implementation

Future<dynamic> getJSON(String key) async {
  if (!_initialized) {
    await init();
  }
  final timeout = remainingDurationForKey(key);
  if (timeout.isNegative) {
    return null;
  }

  final val = await _readString(key);

  if (val != null) {
    return json.decode(val);
  } else {
    return null;
  }
}