delete<S> static method

bool delete<S>({
  1. dynamic key,
  2. String? tag,
  3. bool force = false,
})

Removes the registration for S and disposes of the instance.

If the instance implements LevitScopeDisposable, its onClose method is called. If force is true, deletes even if the dependency was marked as permanent. Returns true if a registration was found and removed.

Implementation

static bool delete<S>({dynamic key, String? tag, bool force = false}) {
  if (key is LevitState) {
    return key.deleteIn(Ls.currentScope, tag: tag, force: force);
  }
  return Ls.delete<S>(tag: tag, force: force);
}