Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Last active March 12, 2024 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdcolvin/6015a34c0887e24d23582667055e17b7 to your computer and use it in GitHub Desktop.
Save tdcolvin/6015a34c0887e24d23582667055e17b7 to your computer and use it in GitHub Desktop.
val sharedFlow = MutableSharedFlow<Int>()
viewModelScope.launch {
var count = 0
// Every 500ms, emit a new number in sequence
while (true) {
delay(500)
sharedFlow.emit(count++)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment