toJson method
The JSON of wayfinder search <bundle> --output=json.
Implementation
Map<String, Object?> toJson() => {
'context': [
for (final entry in context)
{
'chunk': entry.chunk.toMap(),
'similarity': entry.similarity,
'reason': entry.reason,
'viaPath': ?entry.viaPath,
'relationship': ?entry.relationship,
if (entry.sourceChanged) 'sourceChanged': true,
},
],
'matches': [
for (final match in matches)
{
'chunk': match.chunk.toMap(),
'similarity': match.similarity,
if (match.sourceChanged) 'sourceChanged': true,
},
],
'notices': [for (final notice in notices) notice.text],
};