ComposePreferences
ComposePreferences copied to clipboard
Nullable value in PreferenceRequest
Love the concept of the library, but i have slight problem with it's usage (PreferenceRequest to be exact). I have some setting that i want to be nullable. But right now it is simply not possible, since the T have to be the same type as the preferencesKey from DataStore. Since DataStore CAN return store null with non-nullable generic argument then we have a type missmatch here. Example:
val nullableRequest = PreferenceRequest<String?>(
key = stringPreferencesKey("test"),
defaultValue = null
)