Not sure I get what you are trying to do. But look...
# coroutines
k
Not sure I get what you are trying to do. But looking at your code, it doesn't look like you have any mechanism to cancel the
fetchData
operation. If that is the case, and the operation isn't cancelable, then you might be better off just using
suspendCoroutine
. Also, if the fetchData operation is a one off, then you probably don't need to remove listener on completion, since it won't be used anymore regardless. Meanwhile, you should be calling
continuation.resumeWithException
in your
onError
instead of
cancel