putAsync<S> static method

Future<Bind<S>> putAsync<S>(
  1. AsyncInstanceBuilderCallback<S> builder, {
  2. String? tag,
  3. bool permanent = false,
})

Injects an instance of S built asynchronously by builder into the dependency manager, returning a Bind for the registered instance.

Delegates to Get.putAsync: the builder future is awaited and the resulting instance is registered like put, so the regular lifecycle (onInit/onReady) runs on the ready instance. Perform any asynchronous setup inside builder before returning the instance.

  • tag Optional tag to identify this specific instance.
  • permanent If true, prevents the instance from being deleted by SmartManagement.

Implementation

static Future<Bind<S>> putAsync<S>(
  AsyncInstanceBuilderCallback<S> builder, {
  String? tag,
  bool permanent = false,
}) async {
  await Get.putAsync<S>(builder, tag: tag, permanent: permanent);
  return _FactoryBind<S>(autoRemove: permanent, assignId: true, tag: tag);
}