obj

inline fun <T> SharedPreferences.obj(factory: JsonAdapter.Factory, crossinline key: (KProperty<*>) -> String = KProperty<*>::name): ReadWriteProperty<Any, T?>

Use sharedPreferences.obj( key = { "MY_KEY" } )

Receiver

SharedPreferences

Return

ReadWriteProperty

Parameters

factory

JsonAdapter.Factory usually KotlinJsonAdapterFactory or your own choice

key

Function1<*>, String>