17 lines
421 B
Dart
17 lines
421 B
Dart
class Player {
|
|
final String name;
|
|
final Set<String> positions;
|
|
|
|
Player({required this.name, required this.positions});
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
'name': name,
|
|
'positions': positions.toList(),
|
|
};
|
|
|
|
factory Player.fromMap(Map<String, dynamic> map) => Player(
|
|
name: (map['name'] ?? '').toString(),
|
|
positions: Set<String>.from(map['positions'] ?? const []),
|
|
);
|
|
}
|