Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Created October 14, 2020 19:08
Show Gist options
  • Save raulh82vlc/6068218bd15d45fd5199b95395eca545 to your computer and use it in GitHub Desktop.
Save raulh82vlc/6068218bd15d45fd5199b95395eca545 to your computer and use it in GitHub Desktop.
StateFlowHandler cancels scope
@ActivityScope
class StateFlowHandler @Inject constructor(taskThreading: TaskThreading) {
private val scope = CoroutineScope(taskThreading.ui() + SupervisorJob())
private var tweetsListUI: TweetsListUI? = null
// ...
fun cancel() {
scope.cancel()
tweetsListUI = null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment