track<R> method

R track<R>(
  1. R fn()
)

Executes the given function fn within this effect's tracking context.

This registers any signals read during fn as dependencies of this effect.

Implementation

R track<R>(R Function() fn) {
  if (_isDisposed) return fn();
  _runCleanups();
  pushConsumer(this);
  clearDependencies();
  try {
    return fn();
  } finally {
    popConsumer();
  }
}