toProvide method

Binding<T> toProvide(
  1. Provider<T> value
)

Binds a provider function (sync or async) that creates the instance when resolved.

Example:

bind<Api>().toProvide(() => ApiService());
bind<Db>().toProvide(() async => await openDb());

Implementation

Binding<T> toProvide(Provider<T> value) {
  _resolver = ProviderResolver<T>((_) => value.call(), withParams: false);
  return this;
}