Replace StateViewModel with explicit backing fields (#3763)
Assisted-by: Claude:claude-opus-5
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
plugins {
|
||||
alias(mihonx.plugins.android.library)
|
||||
alias(mihonx.plugins.spotless)
|
||||
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "mihon.core.viewmodel"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.lifecycle.viewmodel)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
@@ -1,11 +0,0 @@
|
||||
package mihon.core.viewmodel
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
|
||||
abstract class StateViewModel<S>(initialState: S) : ViewModel() {
|
||||
protected val mutableState: MutableStateFlow<S> = MutableStateFlow(initialState)
|
||||
val state: StateFlow<S> = mutableState.asStateFlow()
|
||||
}
|
||||
Reference in New Issue
Block a user