write method

  1. @override
Method write()
override

Implementation

@override
Method write() {
  final builder = MethodBuilder()
    ..annotations.add(overrideAnnotationExpression)
    ..returns = refer(_queryMethod.rawReturnType.getDisplayString(
      withNullability: true,
    ))
    ..name = _queryMethod.name
    ..requiredParameters.addAll(_generateMethodParameters())
    ..body = Code(_generateMethodBody());

  if (!_queryMethod.returnsStream || _queryMethod.returnsVoid) {
    builder..modifier = MethodModifier.async;
  }
  return builder.build();
}