compact method

  1. @override
Stream<String> compact(
  1. bool dryRun
)
override

Compact the notification queue. Drops every expired notification — those are the only entries that ever leave the queue this way.

Implementation

@override
Stream<String> compact(bool dryRun) async* {
  final List<String> expired = await (await getExpiredKeys()).toList();
  if (dryRun) {
    for (final key in expired) {
      yield key;
    }
    return;
  }
  await _getBox().deleteAll(expired);
  for (final key in expired) {
    _expiryIndex.remove(key);
    yield key;
  }
}