Skip to content

Commit 0fec8d4

Browse files
authored
Mention directive annotations in CHANGELOG and example. (#772)
1 parent 4c0d088 commit 0fec8d4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

example/lib/src/multiplier_generator.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ class MultiplierGenerator extends GeneratorForAnnotation<Multiplier> {
1919

2020
return 'num ${element.name3}Multiplied() => ${element.name3} * $numValue;';
2121
}
22+
23+
// Override this method to respond to annotations on directives: `import`,
24+
// `export`, `library` and/or `part`.
25+
//
26+
// This generator doesn't respond to such annotations, so do nothing.
27+
@override
28+
dynamic generateForAnnotatedDirective(
29+
ElementDirective directive,
30+
ConstantReader annotation,
31+
BuildStep buildStep,
32+
);
2233
}

source_gen/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
do resolution need to switch to the new API, see
55
https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/element_model_migration_guide.md.
66
For questions please use https://github.com/dart-lang/build/discussions.
7+
- **Breaking Change**: annotations are now reported separately for elements
8+
and directives. If you use `TypeChecker().annotatedWith()`, see also
9+
the new `TypeChecker().libraryDirectivesAnnotatedWith()`. If you use
10+
`GeneratorForAnnotation` see the new `generateForAnnotatedDirective`.
711
- Require `build: ^3.0.0`
812
- Updated the minimum package versions for a number of dependencies.
913
- Require Dart 3.7.0

0 commit comments

Comments
 (0)