attach function

Devtools attach(
  1. QueryCache cache, {
  2. int limit = 500,
  3. Clock clock = realClock,
  4. int argsLimit = 200,
  5. FrameOptions? frames,
  6. RequestLog? requests,
  7. ControlledTransport? controls,
  8. Revalidation? revalidation,
  9. OutboxInspector? outbox,
})

Starts observing cache. Chains to an observer already in the slot and gives the slot back on Devtools.dispose if it is still ours.

Nothing crosses principals: when the cache's principal changes, the log, the frame ring and the requests log are purged (one marker each is left), the outbox and sync mirrors are emptied, and an armed failure on controls is disarmed and its delayed requests are aborted, before the cache drops the previous principal's records, so none of what was recorded for one user is readable once the next is in charge. A query a component is still watching is re-mounted by the cache for the new principal under the same key, so that key (and a value in it) reappears in the new session's log exactly as it does in the cache's own registry.

Implementation

Devtools attach(
  QueryCache cache, {
  int limit = 500,
  Clock clock = realClock,
  int argsLimit = 200,
  FrameOptions? frames,
  RequestLog? requests,
  ControlledTransport? controls,
  Revalidation? revalidation,
  OutboxInspector? outbox,
}) => Devtools._(
  cache,
  limit: limit,
  clock: clock,
  argsLimit: argsLimit,
  frames: frames,
  requestLog: requests,
  controls: controls,
  revalidation: revalidation,
  outboxInspector: outbox,
);