getData method
Implementation
Map<String, dynamic> getData() {
Map<String, dynamic> data = {};
if (userId != null) {
data['userId'] = userId!;
}
if (firstName != null) {
data['firstName'] = firstName!;
}
if (lastName != null) {
data['lastName'] = lastName!;
}
if (email != null) {
data['email'] = email!;
}
if (phone != null) {
data['phone'] = phone!;
}
if (country != null) {
data['country'] = country!;
}
if (state != null) {
data['state'] = state!;
}
if (city != null) {
data['city'] = city!;
}
switch (gender) {
case ApiUserGender.FEMALE:
data['gender'] = 'female';
break;
case ApiUserGender.MALE:
data['gender'] = 'male';
break;
case ApiUserGender.OTHER:
data['gender'] = 'other';
break;
default:
break;
}
if (birthday != null) {
data['birthday'] = birthday!.toIso8601String().substring(0, 10);
}
if (company != null) {
data['company'] = company!;
}
if (hashedPhone != null) {
data['hashedPhone'] = hashedPhone!;
}
if (hashedEmail != null) {
data['hashedEmail'] = hashedEmail!;
}
if (smsOptIn != null) {
data['smsOptIn'] = smsOptIn!.toString();
}
if (emailOptIn != null) {
data['emailOptIn'] = emailOptIn!.toString();
}
if (pushOptIn != null) {
data['pushOptIn'] = pushOptIn.toString();
}
if (webPushOptIn != null) {
data['webPushOptIn'] = webPushOptIn.toString();
}
if (attributes != null) {
data['attributes'] = attributes;
}
return data;
}