Closed datt16 closed 2 years ago
https://developer.android.com/topic/libraries/architecture/livedata?hl=ja#create_livedata_objects
MutableLiveDataで定義 .setValue で更新 Observerで監視
val nameObserver = Observer<String> { newName -> UIの処理 }
https://medium.com/firebase-developers/firebase-with-jetpack-compose-cloud-firestore-39d8d139536a
Repository内
callbackFlow
内でイベントリスナーを定義Compose上
Success
が返ってきた時とError
が返ってきた時で分けてUIを定義できるちなみにFactoryってなんだろう
https://developer.android.com/codelabs/kotlin-android-training-view-model?authuser=19&hl=ja#7
A factory method is a method that returns an instance of the same class.
ViewModelをインスタンス化して返すメソッドらしい
ViewModelでデータを扱えるようにしたい
理由:
課題: