updateContactPointValue method

Location updateContactPointValue(
  1. String value, [
  2. int index = 0
])

Implementation

Location updateContactPointValue(String value, [int index = 0]) {
  if (telecom == null || telecom!.isEmpty) {
    return copyWith(telecom: <ContactPoint>[ContactPoint(value: value)]);
  } else if (index >= telecom!.length) {
    return copyWith(
        telecom: <ContactPoint>[...telecom!, ContactPoint(value: value)]);
  } else {
    return copyWith(telecom: <ContactPoint>[
      ...telecom!.sublist(0, index),
      telecom![index].copyWith(value: value),
      ...telecom!.sublist(index + 1)
    ]);
  }
}