fromJson static method
Decodes a report; null for anything unreadable (the route then treats the lens as MISSING and re-gathers it once).
Implementation
static LensReport? fromJson(Object? json) {
if (json is! Map) return null;
final lens = (json['lens'] as String?)?.trim() ?? '';
if (lens.isEmpty) return null;
final rawContext = json['context'];
final rawViolations = json['violations'];
return LensReport(
lens: lens,
context: [
if (rawContext is List)
for (final entry in rawContext)
if (ContextNote.fromJson(entry) case final note?) note,
],
violations: [
if (rawViolations is List)
for (final entry in rawViolations)
if (DiscoveryFinding.fromJson(entry) case final finding?) finding,
],
);
}