MoveHistory class

Manages the history of moves in a chess game

Constructors

MoveHistory.new({String? initialFen})
Creates a move history with an optional initial FEN position

Properties

canGoBack bool
Whether we can go back in history
no setter
canGoForward bool
Whether we can go forward in history
no setter
currentFen String
Current FEN position
no setter
currentIndex int
Current position index in history (-1 means at start)
no setter
hashCode int
The hash code for this object.
no setterinherited
history List<HistoryMove>
All moves in chronological order
no setter
initialFen String
The initial FEN position
no setter
lastMove HistoryMove?
Get the last move made
no setter
length int
Total number of moves in history
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addMove({required String move, required String fen, String? san}) → void
Add a new move to history
clear() → void
Clear all history
getMoveAt(int index) HistoryMove?
Get move at specific index
goBack() String
Go back one move in history
goForward() String?
Go forward one move in history
goToIndex(int index) String
Go to a specific position in history
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited