How to do string concatenate inside viewmodel observe?
So the Categories here is a List which has id and name attribute. I want to concat all of category.name elements in the list before I bind it to view. But the categoryString still "".
private fun getData(id: Int){
buyerViewModel.getProductDetail(id).observe(viewLifecycleOwner){
it.data.let { data ->
var categoryString = ""
data?.Categories?.forEachIndexed { index, category ->
if(index == data?.Categories.size - 1){...