Skip to content

Instantly share code, notes, and snippets.

View pbprateek's full-sized avatar

Prateek kumar pbprateek

  • Bangalore,India
View GitHub Profile
@pbprateek
pbprateek / ComposeScopedViewModelProvider.kt
Last active August 16, 2024 13:24
Viewmodel Scoped to Compose
import android.os.Bundle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.RememberObserver
import androidx.compose.runtime.remember
import androidx.lifecycle.*
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.MutableCreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import androidx.lifecycle.viewmodel.compose.viewModel