push method

PromptStashEntry? push(
  1. String input, {
  2. String? label,
  3. DateTime? timestamp,
})

Push a draft. Empty input is ignored.

Implementation

PromptStashEntry? push(String input, {String? label, DateTime? timestamp}) {
  final text = input.trimRight();
  if (text.isEmpty) return null;
  final entry = PromptStashEntry(
    input: text,
    timestamp: timestamp ?? _clock(),
    label: label,
  );
  _entries.add(entry);
  while (_entries.length > maxEntries) {
    _entries.removeAt(0);
  }
  return entry;
}