bind<T> method

  1. @override
void bind<T>(
  1. dynamic factory(
    1. ContainerInterface
    ), {
  2. bool singleton = false,
})
override

Binds an implementation to an abstract type.

Registers a factory function that will be used to create instances of the specified type. By default, creates a new instance each time the type is resolved (transient binding).

T - The abstract type to bind factory - Factory function that creates the instance singleton - Whether to cache and reuse the instance

Implementation

@override
void bind<T>(
  dynamic Function(ContainerInterface) factory, {
  bool singleton = false,
}) {
  _bindings[T] = _Binding(factory, singleton: singleton);
}