Add helper property for retrieving current VM state (#257)

This commit is contained in:
David Perez authored and Álison Fernandes committed 2024-06-20 17:08:07 +01:00
1 parent a789411b90
commit d1db7521ce
1 file changed
+5
@@ -29,6 +29,11 @@ abstract class BaseViewModel<S, E, A>(
protected val eventChannel: Channel<E> = Channel(capacity = Channel.UNLIMITED)
private val internalActionChannel: Channel<A> = Channel(capacity = Channel.UNLIMITED)
/**
* A helper that returns the current state of the view model.
*/
protected val state: S get() = mutableStateFlow.value
/**
* A [StateFlow] representing state updates.
*/