updateHumanNamePeriod method
Implementation
Patient updateHumanNamePeriod(Period period, [int index = 0]) {
if (name == null || name!.isEmpty) {
return copyWith(name: <HumanName>[HumanName(period: period)]);
} else if (index >= name!.length) {
return copyWith(name: <HumanName>[...name!, HumanName(period: period)]);
} else {
return copyWith(name: <HumanName>[
...name!.sublist(0, index),
name![index].copyWith(period: period),
...name!.sublist(index + 1)
]);
}
}