by remember {}赋值报错Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thu......

var name by remember {mutableStateOf("") }

在compose中使用上面的进行赋值时,出现如下报错信息:Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate解决方法
导入androidx.compose.runtime.getValue

import androidx.compose.runtime.getValue

猜你喜欢

转载自blog.csdn.net/m0_37780940/article/details/117220187