Pluto Datastore Preferences is distributed through mavenCentral. To use it, you need to add the following Gradle dependency to your build.gradle file of you android app module.
Note: add the
no-op
variant to isolate the plugin from release builds.
dependencies {
debugImplementation "com.plutolib.plugins:datastore-pref:$plutoVersion"
releaseImplementation "com.plutolib.plugins:datastore-pref-no-op:$plutoVersion"
}
Now to start using the plugin, add it to Pluto
Pluto.Installer(this)
.addPlugin(PlutoDatastorePreferencesPlugin())
.install()
Create intance of DataStore Preferences and start watching in Pluto.
val Context.appPreferences by preferencesDataStore(
name = PREF_NAME
)
PlutoDatastoreWatcher.watch(PREF_NAME, appPreferences)
🎉 You are all done!
Now re-build and run your app and open Pluto, you will see the Datastore Preferences plugin installed.
To open Datastore plugin screen via code, use this
Pluto.open(PlutoDatastorePreferencesPlugin.ID)