core-ktx / androidx.content / android.content.SharedPreferences / edit

edit

inline fun SharedPreferences.edit(action: Editor.() -> Unit): Unit

Allows editing of this preference instance with a call to SharedPreferences.Editor.apply to persist the changes.

prefs.edit {
    putString("key", value)
}