Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
toshiossada committed Aug 17, 2023
1 parent 18b497e commit 44c9118
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/docs/flutter_modular/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ class AppModule extends Module {
void binds(i) {
i.add(XPTOEmail.new);
i.add<EmailService>(XPTOEmailService.new);
i.addSingleton(Client.new)
i.addSingleton(Client.new);
//You could register bind by tag
i.addSingleton<IHomeController>(HomeController.new, tag: 'home');
i.addSingleton<IHomeController>(HomeController2.new, tag: 'home2');
}
...
Expand All @@ -129,6 +133,9 @@ final client = Modular.get<Client>();
// or set a default value
final client = Modular.get<Client>(defaultValue: Client());
//if you wanna get a instance by tag name
final client = Modular.get<IHomeController>(tag: 'home');
```

## Auto Dispose
Expand Down

0 comments on commit 44c9118

Please sign in to comment.