what If Not Null As
An expression for invoking whatIf when the target object is not null. If the target is not null and the target can be cast by the desired type R, the receiver will get a casted R type.
parcelable.whatIfNotNullAs<Poster> { poster ->
log(poster.name)
}Return
Returns the desired type of object.
Parameters
An expression for invoking whatIf when the target object is not null. If the target is not null and the target can be cast by the desired type R, the receiver will get a casted R type. If the target is null, whatIfNot will be invoked instead of the whatIf without casting.
serializable.whatIfNotNullAs<Poster>(
whatIf = { poster -> log(poster.name) },
whatIfNot = {
// do something
})
Return
Returns the desired type of object.