Feat: Data Model Added
This commit is contained in:
parent
d57add82a2
commit
e86d882e8c
|
@ -0,0 +1,48 @@
|
||||||
|
class Contact {
|
||||||
|
int? id;
|
||||||
|
String name;
|
||||||
|
String? phone;
|
||||||
|
String? email;
|
||||||
|
String? address;
|
||||||
|
String? company;
|
||||||
|
String? notes;
|
||||||
|
|
||||||
|
Contact({
|
||||||
|
this.id,
|
||||||
|
required this.name,
|
||||||
|
this.phone,
|
||||||
|
this.email,
|
||||||
|
this.address,
|
||||||
|
this.company,
|
||||||
|
this.notes,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'phone': phone,
|
||||||
|
'email': email,
|
||||||
|
'address': address,
|
||||||
|
'company': company,
|
||||||
|
'notes': notes,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Contact.fromMap(Map<String, dynamic> map) {
|
||||||
|
return Contact(
|
||||||
|
id: map['id'],
|
||||||
|
name: map['name'],
|
||||||
|
phone: map['phone'],
|
||||||
|
email: map['email'],
|
||||||
|
address: map['address'],
|
||||||
|
company: map['company'],
|
||||||
|
notes: map['notes'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Contact{id: $id, name: $name, phone: $phone, email: $email, address: $address, company: $company, notes: $notes}';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue