toDocument method

Map<String, dynamic> toDocument()

Implementation

Map<String, dynamic> toDocument() => {
  'schema': 'world-diff.v1',
  'spec': 968,
  if (worldHash != null) 'world_hash': worldHash,
  'verdict': verdict.name,
  'behaviors': rows.length,
  'parity': rows.where((r) => r.clazz == DiffClass.parity).length,
  'storm_proof': rows.where((r) => r.clazz == DiffClass.stormProof).length,
  'drift': rows.where((r) => r.clazz == DiffClass.drift).length,
  'unrehearsed_storms': unrehearsedStorms,
  'rows': [for (final row in rows) row.toJson()],
};