functionParameters function

String functionParameters(
  1. MethodElement method
)

Implementation

String functionParameters(final MethodElement method) {
  String arg = "";
  bool hasNamed = false;

  for (var par in method.parameters) {
    if (par.isNamed && !hasNamed) {
      hasNamed = true;
      arg += "{";
    }

    arg +=
        "${(hasNamed && par.isRequired) ? 'required ' : ''}${par.type} ${par.name}${par.hasDefaultValue ? ' = ${par.defaultValueCode}' : ''},";
  }

  if (hasNamed) arg += "}";

  return arg;
}