Skip to content

Commit 7ed297d

Browse files
committed
Publicly expose MutableStateFlow with asStateFlow()
1 parent ccd1cf0 commit 7ed297d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tasks-app-shared/src/commonMain/kotlin/net/opatry/tasks/app/ui/UserViewModel.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Olivier Patry
2+
* Copyright (c) 2025 Olivier Patry
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining
55
* a copy of this software and associated documentation files (the "Software"),
@@ -28,8 +28,8 @@ import io.ktor.client.HttpClient
2828
import io.ktor.client.call.body
2929
import io.ktor.client.request.get
3030
import io.ktor.http.isSuccess
31-
import kotlinx.coroutines.flow.Flow
3231
import kotlinx.coroutines.flow.MutableStateFlow
32+
import kotlinx.coroutines.flow.asStateFlow
3333
import kotlinx.coroutines.launch
3434
import kotlinx.datetime.Clock
3535
import net.opatry.google.auth.GoogleAuthenticator
@@ -68,8 +68,7 @@ class UserViewModel(
6868
) : ViewModel() {
6969

7070
private val _state = MutableStateFlow<UserState?>(null)
71-
val state: Flow<UserState?>
72-
get() = _state
71+
val state = _state.asStateFlow()
7372

7473
private suspend fun fetchUserInfo(): UserInfo? {
7574
return try {

0 commit comments

Comments
 (0)