google-developer-training / basic-android-kotlin-compose-training-inventory-app

Apache License 2.0
77 stars 84 forks source link

Read and update data using Room #51

Open vitordeoliveira opened 1 year ago

vitordeoliveira commented 1 year ago
fun reduceQuantityByOne() {
    viewModelScope.launch {
        val currentItem = uiState.value.itemDetails.toItem()
        if (currentItem.quantity > 0) {
            itemsRepository.updateItem(currentItem.copy(quantity = currentItem.quantity - 1))
        }
    }
}

Unresolved reference: copy

Android Studio Flamingo | 2022.2.1 Patch 2 Build #AI-222.4459.24.2221.10121639, built on May 12, 2023 Runtime version: 17.0.6+0-17.0.6b802.4-9586694 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.4.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 10 Metal Rendering is ON Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=false gradle.version.catalogs.dynamic.support=true