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