Skip to content

Commit 75ecace

Browse files
shawndraperkirov
authored andcommitted
docs(README): fix to Engine example
Previously the example would throw an exception complaining no provider found for Fuel. It would also warn of deprecation of the `withAnnotation:` syntax. This fixes both issues.
1 parent 5631f09 commit 75ecace

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ class ElectricCar {
6868
6969
void main() {
7070
var injector = new ModuleInjector([new Module()
71+
..bind(Fuel)
7172
..bind(GenericCar)
7273
..bind(ElectricCar)
7374
..bind(Engine, toFactory: (fuel) => new V8Engine(fuel), inject: [Fuel])
74-
..bind(Engine, toImplementation: ElectricEngine, withAnnotation: Electric)
75+
..bind(Engine, toImplementation: ElectricEngine, withAnnotation: const Electric())
7576
]);
7677
injector.get(GenericCar).drive(); // Vroom...
7778
injector.get(ElectricCar).drive(); // Hum...

0 commit comments

Comments
 (0)