I have next screen:
@ExperimentalMaterialApi
@Composable
fun AccountListScreen(
navController: NavController,
viewModel: AccountListViewModel = hiltViewModel()
) {
And I want to make a preview for this screen.
I'm trying to do this the following way:
@ExperimentalMaterialApi
@Preview(showBackground = true, backgroundColor = 0xFFFFFF, showSystemUi = true)
@Composable
fun AccountListScreenPreview() {
AccountListScreen(
navController = rememberNavController(),
viewModel = hiltViewModel()
)
}
But unfortunately I get the following error when trying to build a preview:
java.lang.IllegalStateException: ViewModels creation is not supported in Preview
How can this problem be solved? Also here is code of some my classes