drain method

List<Perception> drain()

Drains and returns all non-expired perceptions.

The buffer is emptied after this call.

Implementation

List<Perception> drain() {
  _pruneExpired();
  final result = _buffer.map((b) => b.perception).toList();
  _buffer.clear();
  _logger.debug('Drained ${result.length} perception(s)');
  return result;
}