toggle method

void toggle(
  1. RevalidationSource source
)

Starts source if off, stops it if on. A no-op if unregistered.

Implementation

void toggle(RevalidationSource source) {
  final stop = _running.remove(source);
  if (stop != null) {
    stop();
    return;
  }
  final start = _sources[source];
  if (start != null) _running[source] = start();
}