flagged method

void flagged([
  1. PieceColor? player
])

Sets the current status to GameStatus.whiteFlagged or GameStatus.blackFlagged, depending on who the player is.

If player is left null, the current playerOnTurn is marked as flagged. This is valuable for the clients to actually set the value they received in the game event from server instead of relying on their internal value that might not be the same as the one on server.

Implementation

void flagged([PieceColor? player]) =>
    _gameStatus = (player ?? playerOnTurn) == PieceColor.white
        ? GameStatus.whiteFlagged
        : GameStatus.blackFlagged;