untracked<T> function

T untracked<T>(
  1. T runner()
)

Executes a function without tracking its dependencies.

This function temporarily pauses dependency tracking, executes the provided runner function, and then resets tracking. This is useful when you want to perform operations without triggering reactive updates.

runner is a function that returns a value of type T.

Returns the result of the runner function.

Implementation

T untracked<T>(T Function() runner) {
  try {
    public.pauseTracking();
    return runner();
  } finally {
    public.resetTracking();
  }
}