fromJson static method
Implementation
static ComparedHalf fromJson(Map<String, Object?> json) {
var counts = _counts(json['counts']);
return ComparedHalf(
// `rendered` is the previews half's word, `replayed` the scenario
// half's — and `ran` what the scenario half said before it had one.
worked:
(json['rendered'] ?? json['replayed'] ?? json['ran']) as int? ?? 0,
// The scenario half records this; the previews half never has, because
// its own counts already carry it. Read from there rather than left at
// zero, which is a number and therefore reads as an answer.
skipped: json['skipped'] as int? ?? counts[ComparedState.skipped] ?? 0,
ms: json['ms'] as int? ?? 0,
counts: counts,
because: {
for (var entry in (json['because'] as Map? ?? const {}).entries)
'${entry.key}': entry.value as int? ?? 0,
},
packages: [
for (var package in json['packages'] as List? ?? const []) '$package',
],
note: json['note'] as String?,
);
}