class Liste { final String id; String title; Liste({required this.id, required this.title}); factory Liste.fromJson(Map json) { return Liste(id: json['id'] as String, title: json['title'] as String); } } class Item { final String id; String name; bool checked; int position; Item({ required this.id, required this.name, this.checked = false, this.position = 0, }); factory Item.fromJson(Map json) { return Item( id: json['id'] as String, name: json['name'] as String, checked: json['checked'] as bool? ?? false, position: (json['position'] is int) ? json['position'] : int.tryParse(json['position'].toString()) ?? 0, ); } }