Closed dustincatap closed 1 year ago
reflectable is not recognizing the other types that are annotated unless they are imported in
main.dart
.
It should not be necessary for 'main.dart' to directly import 'foo.dart' and 'bar.dart', but it is (and must be) required that there is an import path from 'main.dart' to 'foo.dart' and to 'bar.dart', in order to include reflection support for the class Foo
and the class Bar
.
The program as such consists of 'main.dart', plus everything which is imported directly into 'main.dart', plus, recursively, everything is imported into each of those imported libraries. In other words, the libraries in the program 'main.dart' is the transitive import closure of the library 'main.dart'.
If any particular library L isn't in that transitive closure than the reflectable code generator never gets to see the declarations, and hence it cannot generate the code which is needed in order to support reflection on anything in L.
Also, it makes no sense to have support for reflection on anything which doesn't exist in the given program, so it would be a waste of space if the reflectable code generator were to find some extra libraries (say, "everything in the current package", or whatever we could come up with) and include them.
There should not be a connection to the language version being 3.0 or earlier, the reflectable code generator has had this behavior from day one.
I'll close this issue because it is working as intended. @dustincatap, please create a new issue if something hasn't been clarified, or isn't working.
After updating to Dart 3.0,
reflectable
is not recognizing the other types that are annotated unless they are imported inmain.dart
.console_app.zip
Here is my
build.yaml
:reflection.dart
foo.dart
:bar.dart
And my
main.dart
: