toJson method

Map<String, dynamic> toJson()

Converts this cache entry to a JSON-serializable map.

Useful for persistent storage implementations like Hive or SharedPreferences.

Implementation

Map<String, dynamic> toJson() => {
  'data': data,
  'timestamp': timestamp.toIso8601String(),
  'ttl': ttl?.inMilliseconds,
};