Hello developers in a composable function i can get context like this : LocalContext.current but how can i get it from a viewmodel class ???This is my viewmodel:
class LoginViewModel(
private val _global: GlobalServices = GlobalServices(),
private val _login:LoginModel= LoginModel(),
private val _loginService: LoginService =LoginService(),
private val retrofitService: IRetrofitService = RetrofitService(),
private val storage:Storage= Storage()
):ViewModel() {
val paddingMain=10.dp
val isChecked = mutableStateOf(false)
val disabled = mutableStateOf(true)
val iconSize=150.dp
val signInFail= mutableStateOf(false)
val showSuccess= mutableStateOf(false)
val global=_global
val login= mutableStateOf(_login, policy = neverEqualPolicy())//policiy is set for not create a copy of LoginModel when set state
fun setEmail(email:String){
login.value.correo=email
refreshStateOfLogin()
}
fun setPassword(ppassword:String){
login.value.password=ppassword
refreshStateOfLogin()
}
}