toJson method

Object toJson()
override

We represent this in JSON as a list with dartMessageName, the index in the arguments list at which we will find the main argument (e.g. howMany for a plural), and then the values of all the possible arguments, in the order that they appear in codeAttributeNames. Any missing arguments are saved as an explicit null.

Implementation

toJson() {
  var json = [];
  json.add(dartMessageName);
  json.add(arguments.indexOf(mainArgument));
  for (var arg in codeAttributeNames) {
    json.add(this[arg]?.toJson());
  }
  return json;
}