34 lines
686 B
Dart
34 lines
686 B
Dart
class Customer {
|
|
final String id;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String phoneNumber;
|
|
|
|
Customer({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.phoneNumber,
|
|
});
|
|
|
|
String get fullName => '$firstName $lastName'.trim();
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'firstName': firstName,
|
|
'lastName': lastName,
|
|
'phoneNumber': phoneNumber,
|
|
};
|
|
}
|
|
|
|
factory Customer.fromMap(Map<String, dynamic> map) {
|
|
return Customer(
|
|
id: map['id'],
|
|
firstName: map['firstName'],
|
|
lastName: map['lastName'],
|
|
phoneNumber: map['phoneNumber'],
|
|
);
|
|
}
|
|
}
|