updateCustom<T> function

bool updateCustom<T>(
  1. ReactiveNode node
)

Updates a custom reactive node and returns whether its value changed.

This function is called by updateNode for nodes that are not standard ComputedReactiveNode or SignalReactiveNode instances. It handles CustomReactiveNode instances by calling their CustomReactiveNode.updateNode method, which allows custom update logic.

For non-custom nodes, this function always returns true, indicating that the node should be treated as changed.

Parameters:

  • node: Custom reactive node to update

Returns: true if the node's value changed, false otherwise

Example:

final customNode = CustomWidgetPropsNode<MyWidget>();
if (updateCustom(customNode) && customNode.subs != null) {
  shallowPropagate(customNode.subs!);
}

Implementation

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
bool updateCustom<T>(ReactiveNode node) {
  node.flags = ReactiveFlags.mutable;

  if (node is CustomReactiveNode) {
    return node.updateNode();
  } else {
    return true;
  }
}