Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dnsang/di

A Dependency Injection package for flutter
https://github.com/dnsang/di

dart dartlang dependency dependency-injection di flutter

Last synced: 2 days ago
JSON representation

A Dependency Injection package for flutter

Awesome Lists containing this project

README

        

# Dart Dependency Injection

**Getting Started**

1/ Binding:

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"));
}