retainNewest method
Keeps the count newest entries (onRetainNewest) and sends
LogEntriesRemovedById with the removed ids, nothing if there was
nothing to remove, or LogStoreInvalidated if the store does not know
what it removed. Throws StateError after close.
Implementation
@override
@nonVirtual
Future<void> retainNewest(int count) async {
assert(count >= 0, 'count must not be negative');
_checkOpen();
final removed = await onRetainNewest(count);
if (removed == null) {
_emit(const LogStoreInvalidated());
} else if (removed.isNotEmpty) {
_emit(LogEntriesRemovedById(removed));
}
}