untrack<T> function

T untrack<T>(
  1. T getter()
)

Untracks the current subscription and returns the result of the getter.

Example:

final value = untrack(count); // Does track the `count` signal.

Implementation

T untrack<T>(T Function() getter) {
  final prevSub = setActiveSub(null), prevContext = setActiveContext(null);
  try {
    return getter();
  } finally {
    setActiveSub(prevSub);
    setActiveContext(prevContext);
  }
}