sabado
This commit is contained in:
@@ -4,26 +4,33 @@ class Team {
|
||||
final String season;
|
||||
final String imageUrl;
|
||||
final bool isFavorite;
|
||||
final String createdAt;
|
||||
final int playerCount; // 👇 NOVA VARIÁVEL AQUI
|
||||
|
||||
Team({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.season,
|
||||
required this.imageUrl,
|
||||
this.isFavorite = false
|
||||
required this.isFavorite,
|
||||
required this.createdAt,
|
||||
this.playerCount = 0, // 👇 VALOR POR DEFEITO
|
||||
});
|
||||
|
||||
// Mapeia o JSON que vem do Supabase (id costuma ser UUID ou String)
|
||||
factory Team.fromMap(Map<String, dynamic> map) {
|
||||
return Team(
|
||||
id: map['id']?.toString() ?? '',
|
||||
name: map['name'] ?? '',
|
||||
season: map['season'] ?? '',
|
||||
imageUrl: map['image_url'] ?? '',
|
||||
name: map['name']?.toString() ?? 'Sem Nome',
|
||||
season: map['season']?.toString() ?? '',
|
||||
imageUrl: map['image_url']?.toString() ?? '',
|
||||
isFavorite: map['is_favorite'] ?? false,
|
||||
createdAt: map['created_at']?.toString() ?? '',
|
||||
// 👇 AGORA ELE LÊ A CONTAGEM DA TUA NOVA VIEW!
|
||||
playerCount: map['player_count'] != null ? int.tryParse(map['player_count'].toString()) ?? 0 : 0,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'name': name,
|
||||
|
||||
Reference in New Issue
Block a user