Feat: Data Model Added

This commit is contained in:
Hadi Mottale 2025-06-11 10:39:17 +03:30
parent d57add82a2
commit e86d882e8c
1 changed files with 48 additions and 0 deletions

48
lib/models/contact.dart Normal file
View File

@ -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}';
}
}