Skip to content
This repository was archived by the owner on Dec 6, 2017. It is now read-only.

Uninitialized Module.DEFAULT_REFLECTOR error

Anting Shen edited this page Aug 8, 2014 · 3 revisions

Error: Module.DEFAULT_REFLECTOR not initialized for dependency injection.

This error is due to DI running in static mode, but the transformer failing to insert initialization code into the main method. Common causes are: not listing the DI transformer or another transformer than includes DI (such as Angular) in pubspec.yaml, and transformer not finding a main method to insert initialization code.

To use recommended behavior, which uses mirrors to resolve dependencies when transformers are off and generated type factories when transformers are enabled, nothing extra must be done, as the transformer should insert necessary code.

To always use static code generation or if using generators, import the statically generated file along with di.dart, then set Module.DEFAULT_REFLECTOR.

For packages without a main method, the apps that depend on them must list DI as a transformer, or the package may define a transformer that calls the DI transformer (Angular is an example of this).

Clone this wiki locally