toMap method

Map<String, String?> toMap()

Implementation

Map<String, String?> toMap() {
  Map<String, String?> userTraits = <String, String?>{};

  if (userId != null) {
    userTraits['user_id'] = userId;
  }

  if (firstName != null) {
    userTraits['first_name'] = firstName;
  }

  if (lastName != null) {
    userTraits['last_name'] = lastName;
  }

  if (email != null) {
    userTraits['email'] = email;
  }

  if (organization != null) {
    userTraits['organization'] = organization;
  }

  if (department != null) {
    userTraits['department'] = department;
  }

  if (jobTitle != null) {
    userTraits['job_title'] = jobTitle;
  }

  if (phone != null) {
    userTraits['phone'] = phone;
  }

  if (website != null) {
    userTraits['website'] = website;
  }

  if (addressFirstLine != null) {
    userTraits['address_one'] = addressFirstLine;
  }

  if (addressSecondLine != null) {
    userTraits['address_two'] = addressSecondLine;
  }

  if (city != null) {
    userTraits['city'] = city;
  }

  if (state != null) {
    userTraits['state'] = state;
  }

  if (zipCode != null) {
    userTraits['zip'] = zipCode;
  }

  if (fax != null) {
    userTraits['fax'] = fax;
  }

  if (annualRevenue != null) {
    userTraits['annual_revenue'] = annualRevenue;
  }

  if (employees != null) {
    userTraits['employees'] = employees;
  }

  if (industry != null) {
    userTraits['industry'] = industry;
  }

  if (customTraits != null && customTraits!.isNotEmpty) {
    userTraits..addAll(customTraits!);
  }

  return userTraits;
}