CyberShark
10/19/2020, 5:54 PMprivate fun checkIfKeySet(): Boolean { .. }
Only way I could Think of is using this, but I want the actual Boolean and don't need to observe changes but rather navigate based on output.
return dataStore.data.map {
it.contains(DataStoreConstants.MY_KEY)
}.asLiveData()
Similar shared preferences code was a one liner, so was hoping the same.
Also, calling first()
or single()
on the flow won't work unless I wrap it in a coroutine which seems unnecessary for a contains check.
Any help is appreciated 🙂Ian Lake
10/19/2020, 5:59 PMsuspend
is certainly expected