GameHistory class

Holds data about moves played.

Constructors

GameHistory()
Constructs new GameHistory object with no moves played.
GameHistory.withMoves({required List<PlayedMove> moves, List<PlayedMove>? futureMoves})
Constructs new GameHistory object with moves already played and with potential futureMoves.

Properties

futureMoves List<PlayedMove>
Contains moves from the future, those that were popped using backward.
final
hashCode int
The hash code for this object.
no setterinherited
length int
Returns the number of moves played by both players.
no setter
moves List<PlayedMove>
Contains all moves played until current position on the board.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(PlayedMove move) → void
Adds a move to the list of played moves.
backward() PlayedMove
Goes one step back through the history and returns the previous move.
forward() PlayedMove
Goes one step forth through the history and returns the next move.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
undo() PlayedMove
Undoes and returns the last move played. This operation cannot be undone!

Operators

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