findScopeContaining static method

ZenScope? findScopeContaining(
  1. dynamic instance
)

Find which scope contains a specific instance Returns the first scope found that contains the instance

Implementation

static ZenScope? findScopeContaining(dynamic instance) {
  for (final scope in ZenScopeManager.getAllScopes()) {
    if (scope.isDisposed) continue; // Skip disposed scopes

    // Check if this scope contains the instance
    final instances = ZenScopeInspector.getAllInstances(scope);
    if (instances.values.contains(instance)) {
      return scope;
    }
  }
  return null;
}