Hi all, I made a code that returns a `User` objec...
# android
o
Hi all, I made a code that returns a
User
object from the Shared Preferences. Here is the line of code I use:
Copy code
private val mCurrentUser = Defaults[PrefsKeys.user]!!
So
Defaults[PrefsKeys.user]!!
returns the current
User
object stored in Shared Preference. The issue is when I change the value in the Shared Preference,
mCurrentUser
is still the same
User
object. Can I replace
mCurrentUser
to be an actual call to the SharedPreference? I guess I am trying to make something like an alias. Because calling Defaults[PrefKeys.user]!! everytime is not very readable.
t
don't use = but get() =
o
thank you! 🙂 @Tolriq