put<S> static method

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

Creates a binding and puts the specified dependency into the GetX service locator.

This method immediately instantiates the dependency and registers it. Use this when you need the dependency to be created right away.

Parameters:

  • dependency: The instance to register
  • tag: Optional tag for identifying this specific instance
  • permanent: If true, the instance won't be removed on widget disposal

Returns a binding widget that can be used in the widget tree.

Implementation

static Bind<S> put<S>(
  S dependency, {
  String? tag,
  bool permanent = false,
}) {
  // Register the dependency with GetX
  Get.put<S>(dependency, tag: tag, permanent: permanent);

  // Return a factory binding with appropriate settings
  return _FactoryBind<S>(
    autoRemove: !permanent, // Invert permanent to get autoRemove behavior
    assignId: true,
    tag: tag,
  );
}