generateForClass method
FutureOr<String?>
generateForClass(
- BuildStep buildStep,
- ClassElement classElement,
- ElementAnnotation annotation
Generates code for an annotated class element.
This is called for each class in the library that has the annotation this generator is targeting.
@param buildStep The build step providing context for generation @param element The annotated class element @param annotation The annotation instance on the class @return Generated code as a string, or null if nothing to generate
Implementation
@override
FutureOr<String?> generateForClass(
BuildStep buildStep,
ClassElement classElement,
ElementAnnotation annotation,
) async {
// The retrofit generator is currently optimized for build_runner/source_gen.
// Full lean_builder support requires adapting the codebase to use lean_builder's
// analyzer abstractions instead of source_gen's API.
//
// For now, this serves as a placeholder for future lean_builder support.
// Users should continue using build_runner for code generation:
// dart pub run build_runner build
throw UnsupportedError(
'Lean Builder support for retrofit_generator is not yet fully implemented.\n'
'The retrofit_generator package currently works with build_runner.\n\n'
'To generate code, please use:\n'
' dart pub run build_runner build\n\n'
'For more information, see: https://github.com/trevorwang/retrofit.dart\n\n'
'Lean Builder support is planned for a future release once lean_builder reaches stable.',
);
}