goToIndex method

String goToIndex(
  1. int index
)

Go to a specific position in history

Implementation

String goToIndex(int index) {
  if (index < -1 || index >= _history.length) {
    return _currentIndex >= 0 ? _history[_currentIndex].fen : _initialFen;
  }

  _currentIndex = index;
  return _currentIndex >= 0 ? _history[_currentIndex].fen : _initialFen;
}