Stylianos Gakis
08/31/2021, 8:24 PM@Preview
extensively and I would say that providing all the fake data sometimes gets repetitive. Doing for example getFakeUserModel(id)
functions work great, but… where do you put those? Where in the package structure do you put your fake preview data? And polluting every class with something like
data class Whatever(...) {
companion object {
fakePreviewWhatever(something: String): Whatever
}
}
is not necessarily something that I love doing.
At the rate that I am doing it now, a big chunk of my files in the package structure would need to be there just to provide fake models which sounds like a great way to confuse newcomers to the codebase. Any tips or tricks on how to do this better?Florian
08/31/2021, 8:38 PMStylianos Gakis
08/31/2021, 8:45 PMWill Shelor
08/31/2021, 8:48 PMhfhbd
08/31/2021, 8:49 PMStylianos Gakis
08/31/2021, 8:59 PMWill Shelor
08/31/2021, 9:13 PMWill Shelor
08/31/2021, 9:15 PMStylianos Gakis
09/01/2021, 12:02 AMIan Lake
09/01/2021, 12:24 AMFlow<ViewState>
, then your Preview can offer a flowOf(LoadingState)
or a flowOf(SomeComplicatedState(input = "withFakeData"))
- you have full control at that point of what your Flow contains