encode method
Implementation
String encode() {
// Insertion order is preserved by Dart maps and respected by
// JsonEncoder, so build the map in the exact output order.
final out = <String, Object?>{'version': version};
final extraKeys = extras.keys.toList()..sort();
for (final k in extraKeys) {
out[k] = extras[k];
}
final sortedCheckKeys = checks.keys.toList()..sort();
out['checks'] = {for (final k in sortedCheckKeys) k: checks[k]!.toJson()};
return '${const JsonEncoder.withIndent(' ').convert(out)}\n';
}