kiwi 0.3.3 kiwi: ^0.3.3 copied to clipboard
A simple yet efficient IoC container for Dart and Flutter (can be coupled with the kiwi_generator package).
import 'package:kiwi/kiwi.dart';
main() {
Container container = Container();
container.registerInstance(Logger());
container.registerSingleton((c) => Logger(), name: 'logA');
container.registerFactory((c) => ServiceA(c.resolve<Logger>('logA')));
}
class Service {}
class ServiceA extends Service {
ServiceA(Logger logger);
}
class Logger {}