untracked<S> function

S untracked<S>(
  1. S computation()
)

Mark a dependency as not tracked by an effect.

Mark a dependency to not be tracked by an effect. The wrapped dependency will not re-run the effect when its value changes but will still return an updated value if the effect re-runs and the untracked signal has changed its value.

Implementation

S untracked<S>(S Function() computation) {
  final (_, :push, :pull) = effects;

  push((_) => _noop);
  final result = computation();
  pull();

  return result;
}