toCode method

String toCode()
override

Return a string representation of this message for use in generated Dart code.

Implementation

String toCode() {
  var out = new StringBuffer();
  out.write('\${');
  out.write(dartMessageName);
  out.write('(');
  out.write(mainArgument);
  var args = codeAttributeNames.where((attribute) => this[attribute] != null);
  args.fold(
      out, (buffer, arg) => buffer..write(", $arg: '${this[arg].toCode()}'"));
  out.write(")}");
  return out.toString();
}