Skip to content

Add a note about not importable annotations #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions source_gen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.2.1-dev

## 1.2.0

- Include the `LibraryElement` in `LibraryReader.allElements`,
Expand Down
9 changes: 8 additions & 1 deletion source_gen/lib/src/generator_for_annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ import 'type_checker.dart';
/// extension, are not searched for annotations. To operate on, for instance,
/// annotated fields of a class ensure that the class itself is annotated with
/// [T] and use the [Element] to iterate over fields. The [TypeChecker] utility
/// may be helpful to check which elements have a given annotation.
/// may be helpful to check which elements have a given annotation if the
/// generator should further filter it's target based on annotations.
///
/// If the annotation type cannot be imported on the Dart VM, for example if it
/// imports `dart:html` or `dart:ui`, then the default behavior of using
/// `TypeChecker.fromRuntime` is not feasible. In these cases extend
/// `GeneratorForAnnotation<void>` and override the [typeChecker] member with a
/// checker matching the annotation type.
abstract class GeneratorForAnnotation<T> extends Generator {
const GeneratorForAnnotation();

Expand Down
2 changes: 1 addition & 1 deletion source_gen/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: source_gen
version: 1.2.0
version: 1.2.1-dev
description: >-
Source code generation builders and utilities for the Dart build system
repository: https://github.com/dart-lang/source_gen
Expand Down