previous method

String? previous()

Navigate to previous entry (older). Returns null if at the beginning.

Implementation

String? previous() {
  if (_entries.isEmpty) return null;

  if (_currentIndex < 0) {
    // Start navigating from the end.
    _currentIndex = _entries.length - 1;
  } else if (_currentIndex > 0) {
    _currentIndex--;
  } else {
    return _entries[0]; // Already at oldest.
  }
  return _entries[_currentIndex];
}