untrack method

void untrack(
  1. String name,
  2. Object resource
)

Removes any ref under name whose target is identical to resource and detaches its Finalizer entry. Silent no-op when name is unknown or no identity match found.

Implementation

void untrack(String name, Object resource) {
  if (!_isEnabled) return;
  final bucket = _buckets[name];
  if (bucket == null) return;
  final removed = bucket.removeIdentityAndReturnTokens(resource);
  for (final token in removed) {
    _finalizer.detach(token);
  }
  if (bucket.isEmpty) {
    _buckets.remove(name);
  }
}