toJson method
The JSON form:
{"CRDTFugueTextHandler": {"kinds": [0, 1, 2], "blob": {"min": 1, "max": 1}}}.
Kinds are sorted, so the same capabilities always encode to the same
JSON. blob is left out when no range is known.
Implementation
Map<String, dynamic> toJson() {
return {
for (final entry in capabilities.byHandlerType.entries)
entry.key: <String, dynamic>{
'kinds': entry.value.operationKinds.toList()..sort(),
if (entry.value.blobVersions case final blob?)
'blob': {'min': blob.min, 'max': blob.max},
},
};
}