I am working (together witg gemini from google) a ...
# compose-desktop
r
I am working (together witg gemini from google) a kmp app. we arte trying to remove an element from a mutablelist. according to the kotln documentation
val removed = _bloodPressureRecords.removeIf { it.id == id }
should work, but accroding to intellij, removeIf does not exist kotlin = "2.1.21", kotlinx-coroutines = "1.10.2", ktor = "3.1.3"
s
A short code snippet might help. Are you certain the list is mutable at that point?
r
Copy code
private val _bloodPressureRecords = mutableStateListOf<BloodPressureRecord>()
    val bloodPressureRecords: List<BloodPressureRecord> = _bloodPressureRecords

...
return try {
            val response: HttpResponse = apiClient.delete("$BASE_URL/bloodpressure/$id")
            if (response.status == HttpStatusCode.NoContent || response.status == HttpStatusCode.OK) {
                // Successfully deleted on server, now remove from local list
                val removed = _bloodPressureRecords.removeIf { it.id == id }
s
r
thanks, I should have checked that, using
removeAll {it.id == id}
👍 1