Skip to content

Read and update data using Room #187

@andnoto

Description

@andnoto

name: Read and update data using Room issue template.
about: Issue template for Read and update data using Room
title: Read and update data using Room
labels: ''
assignees: ''

In my opinion, in the ItemDetailsScreen.kt file, the ItemDetailsBody() function should wrap the composable Button with if (itemUiState.itemDetails.toItem().quantity > 0), otherwise the sell button will appear even if the quantity is 0.
Furthermore, in my opinion, in the ItemDao.kt file, fun getItem(id: Int): Flow should be replaced with fun getItem(id: Int): Flow<Item?>, otherwise, if an item is deleted, the following exception occurs: java.lang.IllegalStateException: The query result was empty, but expected a single row to return a NON-NULL object of type <com.example.inventory.data.Item>.

Versions
_Android Studio version:_Narwhal Feature Drop | 2025.1.2
_API version :_Android 11 (API level 30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions