Skip to content

Instantly share code, notes, and snippets.

@pavan5208
Created Jul 14, 2021
Embed
What would you like to do?
override suspend fun getUserLoggedInState(): Flow<Boolean> {
return protoDataStore.data
.catch { exception ->
// dataStore.data throws an IOException when an error is encountered when reading data
if (exception is IOException) {
emit(UserStore.getDefaultInstance())
} else {
throw exception
}
}.map { protoBuilder ->
protoBuilder.isLoggedIn
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment