Created
January 3, 2022 17:18
-
-
Save WolffDev/6d93aacbaec948d5227c1536b9f6ed91 to your computer and use it in GitHub Desktop.
Streams with click
This file contains hidden or 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
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