In Compose Type safe navigation, I am passing the ...
# compose
n
In Compose Type safe navigation, I am passing the T type class using typeMap, the route which I am passing it is the startDestination, there are some fields which are null from the backend, due to which the below error occurs, anyone have any idea, how to handle nulls here ?
Copy code
java.lang.NullPointerException: Parameter specified as non-null is null: method kotlinx.serialization.encoding.AbstractEncoder.encodeStringElement, parameter value at kotlinx.serialization.encoding.AbstractEncoder.encodeStringElement(Unknown Source:8)
s
Make the parameter nullable?
i
There is a difference between
YourCustomNavType<YourClass>
and
YourCustomNavType<YourClass?>
- you have to use a nullable type if you want to support nullable values