drainEarlyBreadcrumbs static method

List<BufferedBreadcrumb> drainEarlyBreadcrumbs()

Snapshots and clears the early-breadcrumb buffer for the attach-time flush (owned by appInitErrorHandling in Phase 3). Clearing on read prevents a re-flush of the same entries. The caller forwards each to the now-attached reporter without re-redacting (they were redacted at emit time).

Implementation

static List<BufferedBreadcrumb> drainEarlyBreadcrumbs() {
  if (_earlyBreadcrumbBuffer.isEmpty) {
    return const <BufferedBreadcrumb>[];
  }
  final snapshot = List<BufferedBreadcrumb>.of(_earlyBreadcrumbBuffer);
  _earlyBreadcrumbBuffer.clear();
  return snapshot;
}