Provide toString() for ChessCoordinate class.
This commit is contained in:
parent
aa3e3187c4
commit
ce63a3e483
@ -37,8 +37,8 @@ Map<ChessPieceName, String> chessPiecesAssets = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ChessCoordinate {
|
class ChessCoordinate {
|
||||||
late int column;
|
final int column;
|
||||||
late int row;
|
final int row;
|
||||||
|
|
||||||
ChessCoordinate(this.column, this.row);
|
ChessCoordinate(this.column, this.row);
|
||||||
|
|
||||||
@ -60,6 +60,14 @@ class ChessCoordinate {
|
|||||||
return colInt;
|
return colInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
String row = this.row.toString();
|
||||||
|
String col = this.column.toString();
|
||||||
|
|
||||||
|
return '$col$row';
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
operator ==(other) {
|
operator ==(other) {
|
||||||
return other is ChessCoordinate &&
|
return other is ChessCoordinate &&
|
||||||
|
Loading…
Reference in New Issue
Block a user