Skip to content

Instantly share code, notes, and snippets.

@hadiyarajesh
Last active August 9, 2022 14:35
Show Gist options
  • Save hadiyarajesh/6bc0f2571c104ce28b1826a6a698bc35 to your computer and use it in GitHub Desktop.
Save hadiyarajesh/6bc0f2571c104ce28b1826a6a698bc35 to your computer and use it in GitHub Desktop.
/**
*** Live template ***
Learn how to apply at here: https://lnkd.in/dnHYYVEX
*/
// Create a composable function with default Modifier
@androidx.compose.runtime.Composable
fun $NAME$(modifier: androidx.compose.ui.Modifier = androidx.compose.ui.Modifier) {
$END$
}
// Create one mutable and one immutable instances of StateFlow (Mainly used in ViewModel)
private val _$VAR$ = kotlinx.coroutines.flow.MutableStateFlow<$TYPE$>()
val $VAR$: kotlinx.coroutines.flow.StateFlow<$TYPE$> get() = _$VAR$
/**
*** File template ***
Learn how to apply at here: https://lnkd.in/dWzr6Nxe
*/
// Create a file template for Hilt based View Model
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
#end
#parse("File Header.java")
import javax.inject.Inject
import dagger.hilt.android.lifecycle.HiltViewModel
import androidx.lifecycle.ViewModel
@HiltViewModel
class ${NAME} @Inject constructor(
): ViewModel() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment