source_genパッケージを使用する拡張アノテーションを使用してジェネレータを呼び出すにはどうすればよいですか?source_genを使用して拡張アノテーションを使用してジェネレータを呼び出す方法
のは、私は次の発電機を持っているとしましょう:
class MyAnnotationGenerator extends GeneratorForAnnotation<MyAnnotation> {
const MyAnnotationGenerator();
Future<String> generateForAnnotatedElement(ClassElement element, Serializable annotation, BuildStep buildStep) async {
...
}
私はMyAnnotation
を拡張して、すべての注釈のためのMyAnnotationGenerator
を呼び出すしたいと思います。たとえば:
class MyAnnotation {
const MyAnnotation();
}
class MyExtendedAnnotation extends MyAnnotation {
const MyExtendedAnnotation();
}
ので、注釈
MyExtendedAnnotation
が使用されるたびに、私は
MyAnnotationGenerator
を呼び出すしたいと思います。