put<S> method

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

Instantiates and registers a dependency.

Registers within the nearest LScope if available; otherwise uses global Levit.

Implementation

S put<S>(S Function() builder, {String? tag, bool permanent = false}) {
  final scope = _ScopeProvider.of(_context);
  if (scope != null) {
    return scope.put<S>(builder, tag: tag, permanent: permanent);
  }
  return Levit.put<S>(builder, tag: tag, permanent: permanent);
}