I want to negate the following expression:
return SpUtils.loadEMail()?.isEmpty() ?: false
If i add a ! before the expression, like
return !SpUtils.loadEMail()?.isEmpty() ?: false
The IDE(Android Studio) tells me
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Boolean?
How do I negate this kinds of expressions?
.not()
function which you can use with the safe call operator, e.g.SpUtils.loadEMail()?.isEmpty()?.not()
– Kirill Rakhman