Hi I'm wondering if there is a nicer way to write this line of code using scoped functions instead of if else. I want to chain the .addTOBackStack()
function depending on my addToStack
variable
if(addToStack){
supportFragmentManager
.beginTransaction()
.replace(R.id.fragment_container, feedViewFragment)
.addToBackStack(null)
.commit()
}else{
supportFragmentManager
.beginTransaction()
.replace(R.id.fragment_container, feedViewFragment)
.commit()
}