read method

List<NodeDescriptor>? read()

Returns the cached nodes, or null if absent/unreadable.

Implementation

List<NodeDescriptor>? read() {
  final raw = _kv.read(_key);
  if (raw == null) return null;
  try {
    final decoded = jsonDecode(raw);
    if (decoded is! List) return null;
    return [
      for (final item in decoded)
        NodeDescriptor.fromJson((item as Map).cast<String, dynamic>()),
    ];
  } on Object {
    return null;
  }
}