register method

void register(
  1. BuildContext bc,
  2. SunnyInjector context
)

Implementation

void register(BuildContext bc, SunnyInjector context) {
  void _reg<X extends Object>(Inst<X> inst) {
    if (this.isFactory) {
      context.registerSingleton<X>((container) => inst.factory!(bc), isSilent: this.skipIfRegistered);
    } else {
      context.register<X>(
        inst.instance!,
        isSilent: this.skipIfRegistered,
      );
    }
  }

  this.typed(_reg);
}