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

你可能感兴趣的:(by remember {}赋值报错Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thu...)