class DeliveryAddress { String id; String fullName; String addressLine1; String addressLine2; String city; String state; String phoneNumber; bool isDefault; String userID; DeliveryAddress( {this.id, this.fullName, this.addressLine1, this.addressLine2, this.city, this.state, this.phoneNumber, this.userID, this.isDefault = false}); factory DeliveryAddress.fromMap(Map map, String docID) { return DeliveryAddress( id: docID, fullName: map['full_name'], addressLine1: map['address_line1'], addressLine2: map['address_line2'], city: map['city'], state: map['state'], phoneNumber: map['phone_number'], isDefault: map['is_defalut'] ?? false, ); } Map toMap() { return { "id": id, 'full_name': fullName, 'address_line1': addressLine1, 'address_line2': addressLine2, 'city': city, 'state': state, 'phone_number': phoneNumber, 'user_id': userID, }; } bool isChangedForEdit(DeliveryAddress deliveryAddress) { return deliveryAddress.fullName != this.fullName || deliveryAddress.phoneNumber != this.phoneNumber || deliveryAddress.addressLine1 != this.addressLine1 || deliveryAddress.addressLine2 != this.addressLine2 || deliveryAddress.state != this.state || deliveryAddress.city != this.city; } }