Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions example/lib/src/multiplier_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,15 @@ class MultiplierGenerator extends GeneratorForAnnotation<Multiplier> {

return 'num ${element.name3}Multiplied() => ${element.name3} * $numValue;';
}

// Override this method to respond to annotations on directives: `import`,
// `export`, `library` and/or `part`.
//
// This generator doesn't respond to such annotations, so do nothing.
@override
dynamic generateForAnnotatedDirective(
ElementDirective directive,
ConstantReader annotation,
BuildStep buildStep,
);
}
4 changes: 4 additions & 0 deletions source_gen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
do resolution need to switch to the new API, see
https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/element_model_migration_guide.md.
For questions please use https://github.com/dart-lang/build/discussions.
- **Breaking Change**: annotations are now reported separately for elements
and directives. If you use `TypeChecker().annotatedWith()`, see also
the new `TypeChecker().libraryDirectivesAnnotatedWith()`. If you use
`GeneratorForAnnotation` see the new `generateForAnnotatedDirective`.
- Require `build: ^3.0.0`
- Updated the minimum package versions for a number of dependencies.
- Require Dart 3.7.0
Expand Down
Loading