codelab-android-datastore icon indicating copy to clipboard operation
codelab-android-datastore copied to clipboard

Adjust DataStore param in UserPreferencesRepository

Open diegocarloslima opened this issue 3 years ago • 1 comments

On the Working with Preferences DataStore codelab section 6. Persisting data in Preferences DataStore, there is the following snippet of code:

class UserPreferencesRepository(
    private val userPreferencesStore: DataStore<UserPreferences>,
    context: Context
) { ... }

I guess the generics type should be Preferences and not UserPreferences. Otherwise, it gives a type mismatch error when trying to instantiate the UserPreferencesRepository

diegocarloslima avatar Apr 27 '21 12:04 diegocarloslima

Yes should be like :

class UserPreferencesRepository(
    private val userPreferencesStore: DataStore<Preferences>,
    context: Context
) { ... }

heskadon avatar Jun 16 '21 00:06 heskadon

Thank you, fix is underway. Issue can be tracked in #45

mmoczkowski avatar Sep 09 '22 18:09 mmoczkowski