Map<String, dynamic> toJson() { return { 'playerId': playerId.toJson(), if (domNodeId != null) 'domNodeId': domNodeId!.toJson(), }; }