Type ‘TypeVariable(T)’ has no method ‘getValue(Nothing?, KProperty<*>)’ and thus it cannot serve as a delegateってエラー

スポンサーリンク
スポンサーリンク

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

スポンサーリンク
お品書き

現象

var name by rememberSaveable { mutableStateOf("") }

って構文を使おうとした時にタイトルのエラーでた。

スポンサーリンク

対応

import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue

を追加。

スポンサーリンク

参考

r/android_devs - Jetpack Compose - am I stupid or is the 'by remember {}' syntax not working properly?
15 votes and 11 comments so far on Reddit

コメント

タイトルとURLをコピーしました