Last active
March 2, 2024 13:17
-
-
Save tfcporciuncula/38c9f91923fc098b3a0646f97a9bb955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val viewModelStoreOwner = requireNotNull( | |
LocalViewModelStoreOwner.current as? HasDefaultViewModelProviderFactory | |
) | |
val viewModel = viewModel<MyViewModel>( | |
extras = viewModelStoreOwner | |
.defaultViewModelCreationExtras | |
.withCreationCallback<MyViewModel.Factory> { factory -> | |
factory.create(runtimeArg = "abc") | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment