Skip to content

Instantly share code, notes, and snippets.

View AlirezaNezami96's full-sized avatar
🌏
Looking for remote or relocation job

Alireza Nezami AlirezaNezami96

🌏
Looking for remote or relocation job
  • Istanbul, Turkey
View GitHub Profile
@pedrovgs
pedrovgs / ComposeViewModel.kt
Created April 28, 2021 16:58
Example of a base view model for Jetpack Compose
import androidx.lifecycle.*
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
abstract class ComposeViewModel<C, E> : ViewModel(), LifecycleObserver {