ddi 0.1.0 copy "ddi: ^0.1.0" to clipboard
ddi: ^0.1.0 copied to clipboard

outdated

A Dart Dependency Injection package

Flutter Dependency Injection #

Getting Started

1/ Init your module:

class TestModule extends AbstractModule {
    @override
    void init() {
	    bind(String).to("A String Instance");
	    bind(int).to(404);
	    bind(TestClass).to(new TestClass(this.get(String)));
	    bind("AnotherTestClass").to(new TestClass("AnotherTestClass"));
    }
}

2/ Use your DI

void main() {
    DI.init([new TestModule()]);
    String str = DI.get(String);
    expect(str, equals("A String Instance"));
}
2
likes
10
pub points
0%
popularity

Publisher

unverified uploader

A Dart Dependency Injection package

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ddi