cancels

fun <S> MaterialDatePicker<S>.cancels(): Flow<Unit>

Create a Flow of cancel events on the MaterialDatePicker instance. This emits when the user cancels the picker via back button or a touch outside the view. It does not emit when the user clicks the cancel button. To get a Flow of using clicking the cancel button, use the MaterialDatePicker.negativeButtonClicks() binding.

Note: Created flow keeps a strong reference to the MaterialDatePicker instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

datePicker.cancels()
.onEach {
// handle date picker canceled
}
.launchIn(uiScope)

fun MaterialTimePicker.cancels(): Flow<Unit>

Create a Flow of cancel events on the MaterialTimePicker instance. This emits when the user cancels the picker via back button or a touch outside the view. It does not emit when the user clicks the cancel button. To get a Flow of using clicking the cancel button, use the MaterialTimePicker.negativeButtonClicks() binding.

Note: Created flow keeps a strong reference to the MaterialTimePicker instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

timePicker.cancels()
.onEach {
// handle time picker canceled
}
.launchIn(uiScope)