groupsWithTypeK method

Iterable<Entity> groupsWithTypeK(
  1. Entity typeEntity
)

Returns the group entities that contain a dependency keyed by typeEntity. Backed by the reverse type-index, so this is O(K) in the number of matching groups regardless of the total dependency count.

The returned iterable is a live, unmodifiable view of the underlying set; callers that need a stable snapshot must copy it (e.g. .toList()).

Implementation

@pragma('vm:prefer-inline')
Iterable<Entity> groupsWithTypeK(Entity typeEntity) {
  final groups = _typeIndex[typeEntity];
  if (groups == null) return const Iterable<Entity>.empty();
  return UnmodifiableSetView(groups);
}