bulkAnimationData method

BulkAnimationData<TKey> bulkAnimationData()

Captures every per-frame bulk-animation field the render object reads during a single layout — isValid (formerly isBulkAnimating), value (formerly bulkAnimationValue), generation (formerly bulkAnimationGeneration), memberCount, and a per-key membership query (formerly isBulkMember) — into one snapshot.

Render-layer hot paths that previously called four scattered getters per layout (with isBulkMember invoked once per visible node inside the cumulative rebuild) can now fetch the snapshot once and read it for the rest of the frame, restoring the cohesion the four-getter surface lost.

Per-layout cost: zero allocation when no bulk group is active (returns the cached _inactiveBulkData sentinel); one snapshot allocation when active. The snapshot holds direct references to the group's members and pendingRemoval sets — no union or copy — so containsMember runs in O(1) without per-frame set construction.

The returned snapshot captures the set references at call time. A subsequent mutation to the controller's internal bulk group will be reflected through the held set references; callers that need a stable view across mutations must copy the relevant fields out.

Implementation

BulkAnimationData<TKey> bulkAnimationData() {
  final group = _bulkAnimationGroup;
  if (group == null ||
      (group.members.isEmpty && group.pendingRemoval.isEmpty)) {
    return _inactiveBulkData;
  }
  return BulkAnimationData.snapshot<TKey>(
    value: group.value,
    generation: _bulkAnimationGeneration,
    members: group.members,
    pendingRemoval: group.pendingRemoval,
    bulkMemberByNid: _isBulkMemberByNid,
  );
}