addInstance<T> method

  1. @override
void addInstance<T>(
  1. T instance, {
  2. BindConfig<T>? config,
  3. String? key,
})
inherited

Register a instance. A concrete object (Not a function).

injector.addInstance(MyController());

When [key] is provided this instance only can be found by key

Implementation

@override
void addInstance<T>(T instance, {BindConfig<T>? config, String? key}) {
  _add<T>(
    () => instance,
    type: BindType.instance,
    instance: instance,
    config: config,
    key: key,
  );
}