Skip to content

Setup SavedStateFlow

SavedStateFlow is available through Maven Central so declare that in the root build.gradle.

buildscript {
    repositories {
        mavenCentral()
    }   
}
buildscript {
    repositories {
        mavenCentral()
    }
}

For all artifacts listed below, replace <version> with the latest version available on Maven Central Maven Central or check out releases for previous versions. For example:

implementation "com.plusmobileapps:saved-state-flow:1.0"

SavedStateFlow

For the basic SavedStateFlow API that could be used in any dependency injection framework, please import the following.

implementation "com.plusmobileapps:saved-state-flow:<version>"
implementation("com.plusmobileapps:saved-state-flow:<version>")

SavedStateFlow - Hilt

If using Hilt, this is the only dependency that needs to be imported as it bundles in the SavedStateFlow API and allows SavedStateFlowHandle to be injected into any @HiltViewModel.

implementation "com.plusmobileapps:saved-state-flow-hilt:<version>"
implementation("com.plusmobileapps:saved-state-flow-hilt:<version>")

Testing

For the TestSavedStateFlow artifact, import the following for testing.

testImplementation "com.plusmobileapps:saved-state-flow-test:<version>"
testImplementation("com.plusmobileapps:saved-state-flow-test:<version>")