Skip to content

Instantly share code, notes, and snippets.

@hawkkiller
Created August 8, 2022 19:54
Show Gist options
  • Save hawkkiller/60dd2c30f81b85755f2b5edb3e156066 to your computer and use it in GitHub Desktop.
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.
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