contacts_dataist_ir/lib/models/contact.dart

49 lines
926 B
Dart

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