From ce63a3e4838f2414f2213d6e9ca92af794dd2f62 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 13 Nov 2022 14:28:09 +0100 Subject: [PATCH] Provide toString() for ChessCoordinate class. --- lib/chessapp/chess_utils.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/chessapp/chess_utils.dart b/lib/chessapp/chess_utils.dart index 4d6ab40..3e24caf 100644 --- a/lib/chessapp/chess_utils.dart +++ b/lib/chessapp/chess_utils.dart @@ -37,8 +37,8 @@ Map chessPiecesAssets = { }; class ChessCoordinate { - late int column; - late int row; + final int column; + final int row; ChessCoordinate(this.column, this.row); @@ -60,6 +60,14 @@ class ChessCoordinate { return colInt; } + @override + String toString() { + String row = this.row.toString(); + String col = this.column.toString(); + + return '$col$row'; + } + @override operator ==(other) { return other is ChessCoordinate &&