Create a setupReflection method which registers constructor stubs.
Given this source:
@Component(...)
class MyComponent {
MyComponent(MyClass dep);
}
@Injectable()
class MyClass {
MyClass(@Url String name);
}
main() {
bootstrap(MyComponent);
}
generate:
import 'package:path/to/above/file' as file1;
import 'package:reflection/reflection.dart' show reflector;
setupReflection() {
reflector.registerType(
file1.MyComponent,
factory: (file1.MyClass dep) => new file1.MyComponent(dep),
paramaters: const [cost [file1.MyClass]]
);
reflector.registerType(
file1.MyClass,
factory: (String name) => new file1.MyClass(name),
paramaters: const [cost [Url, String]]
);
}
Only the types which are annotated with: Component, Decorator, Template, and Inject need to have the corresponding stubs generated.
Create a
setupReflectionmethod which registers constructor stubs.Given this source:
generate:
Only the types which are annotated with:
Component,Decorator,Template, andInjectneed to have the corresponding stubs generated.