@file:Suppress("OPT_IN_USAGE_FUTURE_ERROR") @file:...
# compose
s
@file:Suppress("OPT_IN_USAGE_FUTURE_ERROR") @file:OptIn(ExperimentalFoundationApi::class) package com.plcoding.auth.presentation.register import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.text2.input.textAsFlow import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.plcoding.auth.domain.UserDataValidator import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach class RegisterViewModel( private val userDataValidator: UserDataValidator ): ViewModel() { var state by mutableStateOf(RegisterState()) private set init { state.email.textAsFlow() .onEach { email -> state = state.copy( isEmailValid = userDataValidator.isValidEmail(email.toString()) ) } .launchIn(viewModelScope) state.password.textAsFlow() .onEach { password -> state = state.copy( passwordValidationState = userDataValidator.validatePassword(password.toString()) ) } .launchIn(viewModelScope) } fun onAction(action: RegisterAction) { } } how to rewrite the above code snippet import androidx.compose.foundation.text2.input.textAsFlow text2 is obsolette from the package
🧵 5
o
There is a possible bug in androidx.compose:compose-bom version 2024.09 upwards. revert back to version 2024.08.00 and androidx.compose.foundation.text2 will no longer be disabled. I had the same problem and it worked for me.
Correction : It is not a bug, but now deprecated in the latest version of androidx-compose:compose-bom.