```mainScope.launch{ onDateChanged // conflat...
# coroutines
m
Copy code
mainScope.launch{
	
			onDateChanged // conflatedBroadcastChannel
                .asFlow()
                .distinctUntilChanged()
                .collect{ ... }

            onTimeChanged // conflatedBroadcastChannel
                .asFlow()
                .distinctUntilChanged()
                .collect{ ... }
}
j
launch two separate coroutines.
mainScope.launch { onDateChanged….} mainScope.launch { onTimeChanged…}
m
can i do it this way, i need access to the same scope
Copy code
mainScope.launch{

			val someValue = withContext(<http://dispatchers.IO|dispatchers.IO>){...}
	
			launch{
				onDateChanged // conflatedBroadcastChannel
	                .asFlow()
	                .distinctUntilChanged()
	                .collect{ ... } // someValue used here
			}

            launch{
	            onTimeChanged // conflatedBroadcastChannel
	                .asFlow()
	                .distinctUntilChanged() 
	                .collect{ ... } // someValue used here
            }
}
v
you can use
onEach
+ `launchIn`:
Copy code
onTimeChanged // conflatedBroadcastChannel
                .asFlow()
                .distinctUntilChanged()
                .onEach { /* collect body */ }
                .launchIn(mainScope)
😲 2
👏 1
m
ok. so i dont have the two inner launches then? Gonna try, thanks