gbtb16 / kiwi

A simple compile-time dependency injection library for Dart and Flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve object by specific type: resolveAs<S, T extends S>

vanlooverenkoen opened this issue · comments

During testing we want to be using a moc implementation of a specific class. But in our tests we want to setup,seed, configure our mocks.

That is why we need a method that can give us an Object from a specific type. That was previously registered.

Something like this:

static T resolveAs<S, T extends S>() => kiwi.Container().resolve<S>() as T;

Fixed in kiwi 1.1.0