ContactWeebi.fromMap constructor
ContactWeebi.fromMap(
- Map<String, dynamic> map
)
Implementation
factory ContactWeebi.fromMap(Map<String, dynamic> map) {
return ContactWeebi(
id: map['id'],
firstName: map['firstName'] ?? '',
lastName: map['lastName'] ?? '',
addressFull: map['addressFull'] != null
? Address.fromMap(map['addressFull'])
: map['addressFull'] == null && map['address'] != null
? Address(
street: map['address'], city: '', country: Country.empty)
: Address.empty,
phone: map['phone'] != null
? Phone.fromMap(map['phone'])
: map['phone'] == null && map['tel'] != null
? Phone(0, map['tel'])
: Phone(0, ''),
mail: map['mail'] ?? '',
avatar: map['avatar'] ?? '',
creationDate: map['creationDate'] == null
? DatesWeebi.defaultDate
: DateTime.tryParse(map['creationDate'] ?? '') == null
? DateTime.fromMillisecondsSinceEpoch(map['creationDate'])
: DatesWeebi.defaultDate,
updateDate: DateTime.tryParse(map['updateDate'] ?? ''),
statusUpdateDate: DateTime.tryParse(map['statusUpdateDate'] ?? ''),
status: map['status'] ?? true,
overdraft: (map['overdraft'] ?? 0) as int,
categories: List<String>.from(map['categories'] ?? []),
isWomanTri: map['isWomanTri'] == null
? Tristate.unknown
: Tristate.tryParse(map['isWomanTri'] as String),
);
}