Is this a bug? Why is it passing through the != nu...
# android
a
Is this a bug? Why is it passing through the != null check eventhough it is null?
t
Is it
null
or is it
"null"
?
☝️ 2
👌 1
a
Oh yeah, it is “null” because I have to convert the Uri to a String: And because the Uri is nullable it is converting the null to a “null”…
Copy code
return UserState(
    username = responseUser.username,
    profileImageUrl = auth.currentUser?.photoUrl.toString(),
    isLoggedIn = true, 
    coins = 10
)
Whats the cleanest/shortest way to check if the Uri is null? profileImageUrl is a nullable String and should be null if the Uri is
t
auth.currentUser?.photoUrl.toString()
->
auth.currentUser?.photoUrl?.toString()
🤝 1
toString works on
Any?
which converts null to “null”
👍 1
but if you prefix it with ?.toString, it preserves the null and doesn’t convert it to string
👍 1
a
Oh good to know, thank you