Skip to content

Latest commit

 

History

History

datastore

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Integrate Datastore Preferences Plugin in your application

Add Gradle Dependencies

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"
}

Install plugin to Pluto

Now to start using the plugin, add it to Pluto

Pluto.Installer(this)
  .addPlugin(PlutoDatastorePreferencesPlugin())
  .install()

Start watching Datastore Preference

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.


Open Plugin view programmatically

To open Datastore plugin screen via code, use this

Pluto.open(PlutoDatastorePreferencesPlugin.ID)