sync property

bool sync
finalinherited

Whether the queue hands an entry to handle on the stack of the call that published it.

Off by default, and the default is the point of the class: publish returns at once and the work happens on a later turn of the event loop. With it on, the underlying stream controller is synchronous, so handle starts before publish returns — an "asynchronous publisher" that runs on the logging call's stack. Measured with a handler that records its own name: sync: true gives before-publish, handle:x, after-publish, and sync: false gives before-publish, after-publish, handle:x.

It is here for tests and for handlers that are genuinely cheap and synchronous, where a turn of the event loop per log is the expensive part. Two things come with it. A handle that throws in this mode throws where the log was written, which is the zone's documented behaviour and not something this class intercepts; and Dart's own warning about synchronous controllers applies — the listener runs inside add, so re-entering the publisher from handle is the caller's problem to avoid.

Implementation

final bool sync;