put<S> method

S put<S>(
  1. S dependency, {
  2. String? tag,
  3. bool permanent = false,
  4. InstanceBuilderCallback<S>? builder,
})

Injects an Instance<S> in memory.

No need to define the generic type <[S]> as it's inferred from the dependency parameter.

  • dependency The Instance to be injected.
  • tag optionally, use a tag as an "id" to create multiple records of the same Type<S> the tag does not conflict with the same tags used by other dependencies Types.
  • permanent keeps the Instance in memory and persist it, not following Get.smartManagement rules. Although, can be removed by GetInstance.reset() and Get.delete()
  • builder If defined, the dependency must be returned from here

Implementation

S put<S>(S dependency,
        {String? tag,
        bool permanent = false,
        InstanceBuilderCallback<S>? builder}) =>
    GetInstance().put<S>(dependency, tag: tag, permanent: permanent);