Hello everyone i am currently using channels to ha...
# coroutines
s
Hello everyone i am currently using channels to handle one time Bluetooth BLE messaging. I have one issue where i use a conflated channel to produce emit only the last updated value. I want to reset/clear the last known value in the channel when the Bluetooth pairing process is done, and i cant seem to find how to reset stored by Channel(.CONFLATED). Any ideas how to do this?
a
you can broadcast a state class instead of the value
Copy code
sealed class BluetoothState {
   object Idle : BluetoothState()
   data class BluetoothState(data: T) : BluetoothState()
}
// reset somewhere
channel.send(BluetoothState.Idle)
👍 1
you can’t reset it unless you make a new instance afaik