Created
August 8, 2022 19:54
-
-
Save hawkkiller/60dd2c30f81b85755f2b5edb3e156066 to your computer and use it in GitHub Desktop.
Debounced restartable which can help you implement the right search behavior, for example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DebouncedRestartableTransformer extends StreamTransformerBase<int, int> { | |
@override | |
Stream<int> bind(Stream<int> stream) { | |
return stream.debounce(const Duration(seconds: 1)).switchMap(Stream.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment