all parameters are now required

This commit is contained in:
gelbeinhalb
2026-01-29 15:39:52 +01:00
parent 3bd6dd4189
commit 1d352821fc
29 changed files with 227 additions and 197 deletions

View File

@@ -9,7 +9,7 @@ class Game {
final Ruleset ruleset;
final String description;
final String color;
final String? icon;
final String icon;
Game({
String? id,
@@ -18,7 +18,7 @@ class Game {
required this.ruleset,
required this.description,
required this.color,
this.icon,
required this.icon,
}) : id = id ?? const Uuid().v4(),
createdAt = createdAt ?? clock.now();

View File

@@ -5,7 +5,7 @@ import 'package:uuid/uuid.dart';
class Group {
final String id;
final String name;
final String? description;
final String description;
final DateTime createdAt;
final List<Player> members;
@@ -13,7 +13,7 @@ class Group {
String? id,
DateTime? createdAt,
required this.name,
this.description,
required this.description,
required this.members,
}) : id = id ?? const Uuid().v4(),
createdAt = createdAt ?? clock.now();

View File

@@ -1,4 +1,5 @@
import 'package:clock/clock.dart';
import 'package:game_tracker/core/enums.dart';
import 'package:game_tracker/data/dto/game.dart';
import 'package:game_tracker/data/dto/group.dart';
import 'package:game_tracker/data/dto/player.dart';
@@ -8,20 +9,20 @@ class Match {
final String id;
final DateTime createdAt;
final String name;
final Game? game;
final Game game;
final Group? group;
final List<Player>? players;
final String? notes;
final String notes;
Player? winner;
Match({
String? id,
DateTime? createdAt,
required this.name,
this.game,
required this.game,
this.group,
this.players,
this.notes,
required this.notes,
this.winner,
}) : id = id ?? const Uuid().v4(),
createdAt = createdAt ?? clock.now();
@@ -37,17 +38,17 @@ class Match {
: id = json['id'],
createdAt = DateTime.parse(json['createdAt']),
name = json['name'],
game = null, // Populated during import via DataTransferService
game = Game(name: '', ruleset: Ruleset.singleWinner, description: '', color: '', icon: ''), // Populated during import via DataTransferService
group = null, // Populated during import via DataTransferService
players = [], // Populated during import via DataTransferService
notes = json['notes'];
notes = json['notes'] ?? '';
/// Converts the Match instance to a JSON object using normalized format (ID references only).
Map<String, dynamic> toJson() => {
'id': id,
'createdAt': createdAt.toIso8601String(),
'name': name,
'gameId': game?.id,
'gameId': game.id,
'groupId': group?.id,
'playerIds': (players ?? []).map((player) => player.id).toList(),
'notes': notes,

View File

@@ -5,13 +5,13 @@ class Player {
final String id;
final DateTime createdAt;
final String name;
final String? description;
final String description;
Player({
String? id,
DateTime? createdAt,
required this.name,
this.description,
required this.description,
}) : id = id ?? const Uuid().v4(),
createdAt = createdAt ?? clock.now();