BoardState class
The immutable state of the Tetris board grid.
Constructors
-
BoardState({required int rows, required int cols, List<
List< ? grid})Cell> > -
BoardState.fromJson(Map<
String, dynamic> json) -
factory
Properties
- cols → int
-
final
-
grid
→ List<
List< Cell> > -
Row-major grid.
0is top-left.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
True when no cell on the board is filled (e.g. after a perfect clear).
no setter
- rows → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cellAt(
int row, int col) → Cell -
clearLines(
) → (BoardState, int) - Returns a new board with completed rows cleared, and the count cleared.
-
copyWith(
{List< List< ? grid}) → BoardStateCell> > -
isRowFull(
int row) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
-
withPieceLocked(
Tetromino piece) → BoardState - Returns a new board with the given tetromino locked in.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited