/// Representa un jugador en la partida class Jugador { final String id; final String nombre; bool esImpostor; bool eliminado; String? palabra; String? endpointId; // Para modo multimóvil Map notas; // nombre_jugador -> nota Jugador({ required this.id, required this.nombre, this.esImpostor = false, this.eliminado = false, this.palabra, this.endpointId, Map? notas, }) : notas = notas ?? {}; Jugador copiar({ bool? esImpostor, bool? eliminado, String? palabra, String? endpointId, }) { return Jugador( id: id, nombre: nombre, esImpostor: esImpostor ?? this.esImpostor, eliminado: eliminado ?? this.eliminado, palabra: palabra ?? this.palabra, endpointId: endpointId ?? this.endpointId, notas: Map.from(notas), ); } Map toJson() => { 'id': id, 'nombre': nombre, 'esImpostor': esImpostor, 'eliminado': eliminado, }; factory Jugador.fromJson(Map json) => Jugador( id: json['id'] as String, nombre: json['nombre'] as String, esImpostor: json['esImpostor'] as bool? ?? false, eliminado: json['eliminado'] as bool? ?? false, ); }