readCache<T> method

  1. @override
T? readCache<T>(
  1. String key
)
override

Implementation

@override
T? readCache<T>(String key) {
  if (gs.hasData(key)) {
    String? value = gs.read<String>(key);
    if (value == null) return null;
    try {
      return EasyHttp.config.cacheSerializer<T>(jsonDecode(value));
    } catch (e, s) {
      if (kDebugMode) {
        log("read type of ${T.runtimeType} cache error", error: e, stackTrace: s);
      }
    }
    return null;
  } else {
    return null;
  }
}