generateForAnnotatedElement method
FutureOr<String>
generateForAnnotatedElement(
- Element element,
- ConstantReader annotation,
- BuildStep buildStep
Implementation
FutureOr<String> generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) {
element as ClassElement;
String baseUrl = annotation.peek('baseUrl')!.stringValue;
HttpMethodParser methodParser = HttpMethodParser(
GetParser(), DeleteParser(), PostParser(), PutParser(), PatchParser());
code_builder.Class createdClass =
methodParser.parse(element, baseUrl: baseUrl);
return _dartfmt
.format('${createdClass.accept(code_builder.DartEmitter())}');
}