String toOriginalCode()

in lib/src/intl_message.dart [557:579]


  String toOriginalCode({bool includeDesc: true, includeExamples: true}) {
    var out = new StringBuffer()..write("Intl.message('");
    out.write(expanded(turnInterpolationBackIntoStringForm));
    out.write("', ");
    out.write("name: '$name', ");
    out.write(locale == null ? "" : "locale: '$locale', ");
    if (includeDesc) {
      out.write(description == null
          ? ""
          : "desc: '${escapeAndValidateString(description)}', ");
    }
    if (includeExamples) {
      // json is already mostly-escaped, but we need to handle interpolations.
      var json = jsonEncoder.encode(examples).replaceAll(r"$", r"\$");
      out.write(examples == null ? "" : "examples: const ${json}, ");
    }
    out.write(meaning == null
        ? ""
        : "meaning: '${escapeAndValidateString(meaning)}', ");
    out.write("args: [${arguments.join(', ')}]");
    out.write(")");
    return out.toString();
  }