class MyViewModel : ViewModel() { private val result = MediatorLiveData() private var expression: String = "" private val calRepo: CalcRepo = CalcRepo() private val _resultLiveData = MutableLiveData() val resultLiveData: LiveData get() = _resultLiveData init { result.addSource(calRepo.resultLiveData) { _resultLiveData.postValue(it) } } private val _expressionLiveData: MutableLiveData = MutableLiveData() // mutable is getting value from the expressionLiveData so that view can't see the mutable val expressionLiveData: LiveData get() = _expressionLiveData // takes any value from the View and wrappes it in a livedata wrapper and uses get() to move the data to the mutable // need to build a fun that changes + into %2B, Url doesn't compute + sign fun equals() { Log.d("bye", "equals triggered") calRepo.getResult(expression).toString() }