toJson method

  1. @override
Map<String, Object?> toJson()

Converts this object to json representation.

Implementation

@override
Map<String, Object?> toJson() {
  return <String, Object?>{
    InsanichessChallengeJsonKey.createdBy: createdBy?.toJson(),
    InsanichessChallengeJsonKey.timeControl: timeControl.toJson(),
    InsanichessChallengeJsonKey.preferColor:
        preferColor == insanichess.PieceColor.white
            ? 'w'
            : preferColor == insanichess.PieceColor.black
                ? 'b'
                : null,
    InsanichessChallengeJsonKey.isPrivate: isPrivate,
    InsanichessChallengeJsonKey.status: status.toJson(),
  };
}