put<T> static method

T put<T>(
  1. T instance, {
  2. String? tag,
  3. bool? isPermanent,
})

Register a dependency in root scope

ZenService instances default to permanent=true. All other types default to permanent=false.

Implementation

static T put<T>(T instance, {String? tag, bool? isPermanent}) {
  // ZenService extends ZenController, so we check the marker type at the
  // call site (zen_service.dart is still importable for the type check).
  final permanent = isPermanent ?? (instance is ZenService);
  return rootScope.put<T>(
    instance,
    tag: tag,
    isPermanent: permanent,
  );
}