toJson method

Map<String, Object?> toJson()

The canonical form: every list sorted by name, so the same contract written in a different order is the same JSON and the same shape.

Implementation

Map<String, Object?> toJson() => <String, Object?>{
  'models': _sortedByName(
    models,
    (DVProtocolModel m) => m.name,
  ).map((DVProtocolModel m) => m.toJson()).toList(),
  'enums': _sortedByName(
    enums,
    (DVProtocolEnum e) => e.name,
  ).map((DVProtocolEnum e) => e.toJson()).toList(),
  'functions': _sortedByName(
    functions,
    (DVProtocolFunction f) => f.name,
  ).map((DVProtocolFunction f) => f.toJson()).toList(),
};