Timestamp zu allen Objekten hinzufügen #36
@@ -8,14 +8,17 @@ class Game {
|
|||||||
final List<Player>? players;
|
final List<Player>? players;
|
||||||
final Group? group;
|
final Group? group;
|
||||||
final String winner;
|
final String winner;
|
||||||
|
final DateTime createdAt;
|
||||||
|
|
||||||
Game({
|
Game({
|
||||||
String? id,
|
String? id,
|
||||||
|
DateTime? createdAt,
|
||||||
required this.name,
|
required this.name,
|
||||||
this.players,
|
this.players,
|
||||||
this.group,
|
this.group,
|
||||||
this.winner = '',
|
this.winner = '',
|
||||||
}) : id = id ?? const Uuid().v4();
|
}) : id = id ?? const Uuid().v4(),
|
||||||
|
createdAt = createdAt ?? DateTime.now();
|
||||||
|
|
||||||
|
flixcoo marked this conversation as resolved
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|||||||
@@ -5,9 +5,15 @@ class Group {
|
|||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
final List<Player> members;
|
final List<Player> members;
|
||||||
|
final DateTime createdAt;
|
||||||
|
|
||||||
Group({String? id, required this.name, required this.members})
|
Group({
|
||||||
: id = id ?? const Uuid().v4();
|
String? id,
|
||||||
|
DateTime? createdAt,
|
||||||
|
required this.name,
|
||||||
|
required this.members,
|
||||||
|
}) : id = id ?? const Uuid().v4(),
|
||||||
|
createdAt = createdAt ?? DateTime.now();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import 'package:uuid/uuid.dart';
|
|||||||
class Player {
|
class Player {
|
||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
|
final DateTime createdAt;
|
||||||
|
|
||||||
Player({String? id, required this.name}) : id = id ?? const Uuid().v4();
|
Player({String? id, DateTime? createdAt, required this.name})
|
||||||
|
: id = id ?? const Uuid().v4(),
|
||||||
|
createdAt = createdAt ?? DateTime.now();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|||||||
Reference in New Issue
Block a user
Warum Clock verwendet und nicht DateTime?
Datetime hat nicht die möglichkeit eine fakeclock zu erstellen, clock schon, nutzt aber under the hood afaik datetime