adjorno
07/17/2024, 12:17 PMprivate var fileDumpJob: Job? = null
private fun onDataUpdated() {
fileDumpJob?.cancel()
fileDumpJob = null
fileDumpJob = launch {
dumpDataToFile()
}
}
Could there be a problem with this approach? Is there a more elegant solution?Sam
07/17/2024, 12:48 PMStateFlow
.adjorno
07/17/2024, 1:09 PMadjorno
07/17/2024, 1:58 PMSam
07/17/2024, 2:20 PMdumpDataToFile()
function implemented? Cancellation is cooperative, and it's likely that your file-writing operation isn't cancellable.