remember mutableStateOf cannot serve as a delegate

25 Views Asked by At

I'm trying to implement tabs with Composable and was following this tutorial: How to Create Tabs in Jetpack Compose. This line (inside a Composable function) produces the following error:

var tabIndex by remember { mutableStateOf(0) }

Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate

Why? I don't understand the error.

I found another tutorial: Jetpack Compose — Top Tabs, but it's incomplete unfortunately. Every code snippet uses a variable pagerState, that is nowhere defined. Furthermore, Pager Compose is experimental and I don't really need the pager functionality anyway.

0

There are 0 best solutions below