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