At the moment (Dart 3.6.0) creates a macro file with the following content:
part of 'path_to_parent_file.dart';
// Generated code
Which means it is part of the parent file.
Everything works fine in the IDE. The analyzer treats types imported in the parent file as known types in the generated file code.
That is, if, for example, the type Foo
is imported in the parent file, then it is also known in the generated macro file.
But when trying to execute the program, the type that was known in both files (parent and generated) becomes unknown in the generated file.
Accordingly, I cannot understand what works correctly and what does not work correctly.
If the analyzer works correctly, then this type should be known when executing the program.
If the code generated for executing the program is correct, then the analyzer should have issued an error in the IDE that this type is unknown (in the generated file).
Example of error message:
org-dartlang-augmentation:/E:/prj/test_macros/example/example.dart-0:72:21: Error: 'Foo' isn't a type.