class MedViewModel @Inject constructor(
private val taskRepository: TaskRepository
) : BaseViewModel() {
private var taskId: Int = -1
fun fetchLastScannedCode() {viewModelScope.launch {
taskRepository.fetchLastScannedTaskItems().collect { taskItems ->
logInCrashlytics(
functionName = "fetchLastScannedTaskItems",
statusName = "TaskItems",
objectName = taskItems.toString()
)
taskItems?.let {
taskId = taskItems.task?.id!!
task = taskItems.task
taskItem = it.taskItemsList.firstOrNull()
}}}}