put<S> static method

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

Instantiates and registers a dependency using a builder.

The builder is executed immediately. If Levit.enableAutoLinking is active, any reactive variables created during execution are automatically captured and linked to the resulting instance for cleanup.

// Example usage:

final service = Levit.put(() => MyService());

If permanent is true, the instance survives a non-forced reset. Use tag as an optional unique identifier to allow multiple instances of the same type S.

Implementation

static S put<S>(S Function() builder, {String? tag, bool permanent = false}) {
  return Ls.put<S>(builder, tag: tag, permanent: permanent);
}