first commit
This commit is contained in:
35
lib/models/models.dart
Normal file
35
lib/models/models.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
class Liste {
|
||||
final String id;
|
||||
String title;
|
||||
|
||||
Liste({required this.id, required this.title});
|
||||
|
||||
factory Liste.fromJson(Map<String, dynamic> 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<String, dynamic> 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user