private fun setAddress( address1: String? = null, address2: String? = null, address3: String? = null, city: String? = null, zipcode: String? = null ) { if (address1 != null) { _uiState.value = uiState.value.copy( addressFields = _uiState.value.addressFields.copy( address1 = InputWrapper(value = address1, errorId = null) ) ) } if (address2 != null) { _uiState.value = uiState.value.copy( addressFields = _uiState.value.addressFields.copy( address2 = InputWrapper(value = address2, errorId = null) ) ) } if (address3 != null) { _uiState.value = uiState.value.copy( addressFields = _uiState.value.addressFields.copy( address3 = InputWrapper(value = address3, errorId = null) ) ) } if (city != null) { _uiState.value = uiState.value.copy( addressFields = _uiState.value.addressFields.copy( city = InputWrapper(value = city, errorId = null) ) ) } if (zipcode != null) { _uiState.value = uiState.value.copy( addressFields = _uiState.value.addressFields.copy( zipcode = InputWrapper(value = zipcode, errorId = null) ) ) } }
This method save the address fields in the UI form