InsanichessChallenge.fromJson constructor
Creates new InsanichessChallenge
from json
.
Implementation
InsanichessChallenge.fromJson(Map<String, dynamic> json)
: createdBy = json[InsanichessChallengeJsonKey.createdBy] == null
? null
: InsanichessPlayer.fromJson(
json[InsanichessChallengeJsonKey.createdBy]),
timeControl = InsanichessTimeControl.fromJson(
json[InsanichessChallengeJsonKey.timeControl]),
preferColor = json[InsanichessChallengeJsonKey.preferColor] == 'w'
? insanichess.PieceColor.white
: json[InsanichessChallengeJsonKey.preferColor] == 'b'
? insanichess.PieceColor.black
: null,
isPrivate = json[InsanichessChallengeJsonKey.isPrivate],
status =
challengeStatusFromJson(json[InsanichessChallengeJsonKey.status]);