printArgs method

String printArgs(
  1. List<GraphQLFieldInput> args, [
  2. String indentation = ''
])

Implementation

String printArgs(
  List<GraphQLFieldInput> args, [
  String indentation = '',
]) {
  if (args.isEmpty) {
    return '';
  }

  // If every arg does not have a description, print them on one line.
  if (args.every((arg) => arg.description == null)) {
    return '(' + args.map(printInputValue).join(', ') + ')';
  }

  return '(\n' +
      args
          .mapIndexed(
            (i, arg) =>
                printDescription(
                    arg.description, '  ' + indentation, i == 0) +
                '  ' +
                indentation +
                printInputValue(arg),
          )
          .join('\n') +
      '\n' +
      indentation +
      ')';
}