alexsullivan114
04/16/2019, 8:46 PMOptional objects. Am I missing something here?alexsullivan114
04/16/2019, 8:47 PMObseravble. If Kotlins nullability represented actual Optional objects I'd be fine.alexsullivan114
04/16/2019, 8:47 PMOptional library or build my own, and that seems super weird to do since nullability is built into the type systemjw
04/16/2019, 8:48 PMnull as a valid value.jw
04/16/2019, 8:48 PMalexsullivan114
04/16/2019, 8:49 PMjw
04/16/2019, 8:49 PMFlow type in the coroutine library allows nullsalexsullivan114
04/16/2019, 8:50 PMFlow is definitely on my list of things to learn. A bit out of scope for what I'm trying to do right now but I'm going to try and move in that direction anywaysCody Engel
04/17/2019, 12:51 AMclass LocalUser(
val apiKey: String?,
val userId: Int?
)
class AuthenticationRecord(
val apiKey: String,
val userId: Int?
)
object NotAuthenticated
val authResponse = try {
AuthenticationRecord(
localUser.apiKey!!,
localUser.userId!!
)
} catch (ex: KotlinNullPointerException) {
NotAuthenticated
}jw
04/17/2019, 3:09 AMCody Engel
04/17/2019, 1:57 PMjw
04/17/2019, 2:01 PMCody Engel
04/17/2019, 2:10 PMalexsullivan114
04/18/2019, 11:04 AMCody Engel
04/18/2019, 12:33 PM