kiwi_generator 4.1.0 copy "kiwi_generator: ^4.1.0" to clipboard
kiwi_generator: ^4.1.0 copied to clipboard

Generates dependency injection code using the kiwi package to reduce development time.

example/kiwi_generator_example.dart

import 'package:kiwi/kiwi.dart';

part 'kiwi_generator_example.g.dart';

abstract class Injector {
  @Register.singleton(ServiceA)
  @Register.factory(Service, from: ServiceB)
  @Register.factory(ServiceB, name: 'factoryB')
  @Register.factory(ServiceC, resolvers: {ServiceB: 'factoryB'})
  void configureWithScopedContainer(KiwiContainer scopedContainer);

  @Register.factory(ServiceC, resolvers: {ServiceB: 'factoryB'})
  void configureWithScopedContainer2([KiwiContainer scopedContainer]);

  @Register.factory(ServiceC, resolvers: {ServiceB: 'factoryB'})
  void configureWithScopedContainer3({KiwiContainer scopedContainer});

  @Register.factory(ServiceC, resolvers: {ServiceB: 'factoryB'})
  void configureWithScopedContainer4({KiwiContainer scopedContainer});

  @Register.singleton(ServiceA)
  @Register.factory(Service, from: ServiceB)
  @Register.factory(ServiceB, name: 'factoryB')
  @Register.factory(ServiceC, resolvers: {ServiceB: 'factoryB'})
  void configure();

  void methodWithoutAnnotations();

  void configureInjector() {}
}

class Service {}

class ServiceA extends Service {}

class ServiceB extends Service {
  ServiceB(ServiceA serviceA);
}

class ServiceC extends Service {
  ServiceC(ServiceA serviceA, ServiceB serviceB);

  ServiceC.other(ServiceB serviceA);
}

void setup() {
  var injector = _$Injector();
  injector.configure();
}
11
likes
110
pub points
81%
popularity

Publisher

verified publishergbtb16.com.br

Generates dependency injection code using the kiwi package to reduce development time.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

analyzer, build, build_config, built_collection, code_builder, dart_style, kiwi, path, source_gen

More

Packages that depend on kiwi_generator