method static method

String method(
  1. List<MethodInfo> methods
)

create method

Implementation

static String method(List<MethodInfo> methods) {
  String result = "";
  methods.forEach((method) {
    String methodComment =
        "\n${method.comment}/// Dart method declaraction: ${method.originDeclaration}\n";
    method.args.forEach((element) {
      methodComment +=
          "/// @param ${element.name} Agument ${element.name}, type: ${element.type}.\n";
    });
    result += methodComment;
    result += "- (" + getTypeString(method.returnType) + ")" + method.name;
    String argType = "";
    if (!method.args.isEmpty) {
      result += ":";
      for (var i = 0; i < method.args.length; i++) {
        Property arg = method.args[i];
        if (i > 0) {
          argType += " ${arg.name}:";
        }
        argType += "(";
        if (arg.canBeNull && typeOf(arg) != ObjectivePropertType.base) {
          argType += "nullable ";
        }
        argType += getTypeString(arg) + ")" + arg.name;
      }
    }
    result += "$argType;\n";
  });
  return result;
}