findGroupIndex method

int? findGroupIndex(
  1. String guid
)

Find the index of a group by its GUID using O(1) lookup

Returns the index of the group in the items list, or null if not found. This method uses a Map for O(1) lookup performance.

Requirement: 1.5

Implementation

int? findGroupIndex(String guid) {
  if (guid.isEmpty) return null;
  if (_mapNeedsRebuild && items.isNotEmpty) {
    _rebuildIndexMap();
  }
  return _groupIndexMap[guid];
}