Hi Thomas! Thanks for pointing this out.

I had added the lazy keyword later.

I just realized it's not possible to specify the "lazy" keyword on the class constructor parameters, but only on the standard properties.

However in case of data classes, we need to specify the fields as constructor parameters, otherwise we are not able to use the data class "copy" function.

So, I updated the article, removing the lazy keyword.

In terms of objects instantiation, you can decide when it's more convenient. In case of a small app, you can easily instantiate all screen state objects directly in the AppState definition:

data class AppState (

val homeScreen = HomeData(),

val listScreen = ListData(),

val detailScreen = DetailData(),



In case of apps with many screens, you can decide to default most of them to null.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store