Import sorgenti Flutter di Henflow (export da Nextcloud: lib/ + documenti di progetto)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
class Hen {
|
||||
final String id;
|
||||
final String name;
|
||||
final DateTime birthDate;
|
||||
bool isLaying;
|
||||
|
||||
Hen({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.birthDate,
|
||||
this.isLaying = true,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'birthDate': birthDate.toIso8601String(),
|
||||
'isLaying': isLaying,
|
||||
};
|
||||
}
|
||||
|
||||
factory Hen.fromMap(Map<String, dynamic> map) {
|
||||
return Hen(
|
||||
id: map['id'],
|
||||
name: map['name'],
|
||||
birthDate: DateTime.parse(map['birthDate']),
|
||||
isLaying: map['isLaying'] ?? true,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user