<Why Kotlin data classes can have nulls in non-nul...
# stackoverflow
u
Why Kotlin data classes can have nulls in non-nullable fields? In Kotlin you can create a data class: data class CountriesResponse( val count: Int, val countries: List, val error: String) Then you can use it to parse a JSON, for instance, "{n: 10}". In this case you will have an object val countries: CountriesResponse, received from Retrofit, Fuel or Gson, that contains these values: count = 0, countries = null, error = null. In <a...