isEligibleForPromotion method
Checks if a piece is eligible for promotion.
Implementation
bool isEligibleForPromotion(Position position) {
ChessPiece? piece = getPiece(position);
if (piece?.type == PieceType.pawn) {
if (position.row == 0 || position.row == 7) {
return true;
}
}
return false;
}