add method
Returns a new OutputLog with entry appended.
If the resulting log would exceed maxEntries, the oldest entries are dropped.
Implementation
OutputLog add(OutputLogEntry entry) {
final newEntries = [..._entries, entry];
if (newEntries.length > maxEntries) {
return OutputLog(
maxEntries: maxEntries,
entries: newEntries.sublist(newEntries.length - maxEntries),
);
}
return OutputLog(maxEntries: maxEntries, entries: newEntries);
}