Skip to content

Instantly share code, notes, and snippets.

@WolffDev
Created January 3, 2022 17:18
Show Gist options
  • Save WolffDev/6d93aacbaec948d5227c1536b9f6ed91 to your computer and use it in GitHub Desktop.
Save WolffDev/6d93aacbaec948d5227c1536b9f6ed91 to your computer and use it in GitHub Desktop.
Streams with click
import 'dart:html';
void main() {
final ButtonElement button = querySelector('button') as ButtonElement;
button.onClick
.timeout(
Duration(seconds: 1),
onTimeout: (sink) => sink.addError("You have lost")
).listen(
(event) {},
onError: (err) => print(err)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment