Issue
private val Context.dataStore by preferencesDataStore("app_preferences")
I want to use the datastore above but the variable cannot be read or used in the fragment. like this picture
Solution
To get dataStore
reference in Fragment
private val Context.dataStore by preferencesDataStore("app_preferences")
// in Fragment
val pref = requireContext().dataStore
Answered By - Muhammad Rio
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.