watch method

void watch({
  1. String? nodeId,
  2. Duration minInterval = Duration.zero,
})

Turns the watch on or off, and says what it is watching.

Idempotent: asking for a watch that is already running with the same arguments changes nothing, because the panel restates its interest on every rebuild and a watch that restarted each time would never accumulate the frame it is supposed to be comparing against.

Implementation

void watch({String? nodeId, Duration minInterval = Duration.zero}) {
  _minInterval = minInterval;
  if (_nodeId != nodeId) {
    _nodeId = nodeId;
    _node = null;
    _resolved = false;
    _box = null;
  }
  if (_watching) return;
  _watching = true;
  _shape = null;
  _size = null;
  _scrolls = null;
  _frames = 0;
  _pushes = 0;
  _hashMicrosTotal = 0;
  _hashMicrosMax = 0;
  // The "last seen" figures too, which is not obvious and was got wrong: a
  // watch started on an entry that never draws a frame kept reporting the
  // *previous* entry's node count and resolve cost, so a run of static demos
  // all claimed the size of whichever animating one came before them.
  _hashMicrosLast = 0;
  _resolveMicrosLast = 0;
  _nodeCount = 0;
  _sinceLastPush.reset();
  _arm();
}