Removing use of dart:mirrors
to allow AOT compile
#4139
davidmorgan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The latest
source_gen
release deprecatesTypeChecker.fromRuntime
, because it uses mirrorshttps://pub.dev/documentation/source_gen/3.1.0/source_gen/TypeChecker/TypeChecker.fromRuntime.html
the intended replacement is the new
TypeChecker.typeNamed
https://pub.dev/documentation/source_gen/3.1.0/source_gen/TypeChecker/TypeChecker.typeNamed.html
--the is a little looser than
TypeChecker.fromRuntime
, it gets the name from the type you pass and then you should also explicitly pass a package name, so it matches name+package instead of full name+URI. This is usually what you want! As it doesn't make sense to stop detecting an annotation because it moved between files in the same package.The next
source_gen
major version bump will removeTypeChecker.typeNamed
, and then it will be possible to compile AOT. I need to teachbuild_runner
to compile AOT in the meantime, work in progress :)One important note, the
source_gen
GeneratedForAnnotation
usesTypeChecker.fromRuntime
, you can keep using the annotation generator but you should start passing the annotation package name now, it will switch toTypeChecker.typeNamed
with the breaking release.https://pub.dev/documentation/source_gen/3.1.0/source_gen/GeneratorForAnnotation/GeneratorForAnnotation.html
Beta Was this translation helpful? Give feedback.
All reactions