isValidLink method

bool isValidLink(
  1. Link checkLink,
  2. ReactiveNode sub
)

Validates that a link belongs to a node's dependency list.

Checks if checkLink is present in sub's dependency chain. Used during propagation to ensure link integrity and detect stale references.

Returns true if the link is valid, false otherwise.

Implementation

@pragma('vm:align-loops')
bool isValidLink(final Link checkLink, final ReactiveNode sub) {
  Link? link = sub.depsTail;
  while (link != null) {
    if (identical(link, checkLink)) return true;
    link = link.prevDep;
  }
  return false;
}