Tristan
02/03/2020, 12:44 AMmodel
along side ambient
? If any of you is coming from Angular and could make a little comparaison for understanding, that would be great 😮
I would do something
class UserService {
// ...
privatte val event = ConflatedBroadcastChannel<User>()
val user = event.asFlow()
fun login(val args: Any) {
// ...
event.offer(User())
}
}
@Composable
fun UserCard() {
var userService by inject<UserService>()
userService.user.onEach {
Text(it.name)
}.launchIn(ComponentContext)
}
Of course, I am sure there is better, and I know coroutines are not properly supported yet 😄
Please, guide me