toJson method

Object? toJson()
override

We represent this in JSON as a List with the name of the message (e.g. Intl.select), the index in the arguments list of the main argument, and then a Map from the cases to the List of strings or sub-messages.

Implementation

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