isValidLink function

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

Checks if a link is still valid for a subscriber.

Parameters:

  • checkLink: The link to check
  • sub: The subscriber node

Returns: true if the link is still valid

Example:

final effectNode = CustomEffectNode();
final link = effectNode.depsTail!;
final stillValid = isValidLink(link, effectNode);

Implementation

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
bool isValidLink(Link checkLink, ReactiveNode sub) {
  var link = sub.depsTail;

  while (link != null) {
    if (link == checkLink) {
      return true;
    }
    link = link.prevDep;
  }
  return false;
}