26 lines
608 B
Dart
26 lines
608 B
Dart
class Person {
|
|
final String id;
|
|
final String teamId;
|
|
final String name;
|
|
final String type; // 'Jogador' ou 'Treinador'
|
|
final String number;
|
|
|
|
Person({
|
|
required this.id,
|
|
required this.teamId,
|
|
required this.name,
|
|
required this.type,
|
|
required this.number,
|
|
});
|
|
|
|
// Converte o JSON do Supabase para o objeto Person
|
|
factory Person.fromMap(Map<String, dynamic> map) {
|
|
return Person(
|
|
id: map['id'] ?? '',
|
|
teamId: map['team_id'] ?? '',
|
|
name: map['name'] ?? '',
|
|
type: map['type'] ?? 'Jogador',
|
|
number: map['number']?.toString() ?? '',
|
|
);
|
|
}
|
|
} |