CacheEntry.fromJson constructor

CacheEntry.fromJson(
  1. Map<String, dynamic> json
)

Deserializes a cache entry from JSON.

Implementation

factory CacheEntry.fromJson(Map<String, dynamic> json) {
  return CacheEntry(
    response: ProxyResponse(
      statusCode: json['statusCode'] as int,
      headers: Map<String, String>.from(json['headers'] as Map),
      body: json['body'] as String,
      cached: true,
    ),
    cachedAt: DateTime.parse(json['cachedAt'] as String),
    expiresAt: DateTime.parse(json['expiresAt'] as String),
    key: json['key'] as String,
  );
}