class Playlist { final int? id; final String name; final String erstelltAm; int songCount; Playlist({ this.id, required this.name, String? erstelltAm, this.songCount = 0, }) : erstelltAm = erstelltAm ?? DateTime.now().toIso8601String(); Map toMap() => { 'id': id, 'name': name, 'erstellt_am': erstelltAm, }; factory Playlist.fromMap(Map m, {int songCount = 0}) => Playlist( id: m['id'] as int?, name: m['name'] as String, erstelltAm: m['erstellt_am'] as String?, songCount: songCount, ); }