method static method

String method(
  1. List<MethodInfo> methods
)

create method

Implementation

static String method(List<MethodInfo> methods) {
  String result = "";
  methods.forEach((method) {
    String argType = "";
    method.args.forEach((arg) {
      argType += getTypeStr(arg) + " " + arg.name + ", ";
    });
    if (argType.endsWith(", ")) {
      //remove ", " ,because java method arg can't end with ", "
      argType = argType.substring(0, argType.length - 2);
    }
    String body = ";";
    //don't support no abstract method
    // if (method.isAbstract) {
    //   body = ";";
    // } else {
    //   body = "{}";
    // }
    result += "\t" +
        getTypeStr(method.returnType) +
        " " +
        method.name +
        "(" +
        argType +
        ")$body\n";
  });
  return result;
}