Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Dispatching custom events example for Dart Web projects
<input type="text" />
import 'dart:html';
void main() {
final input = querySelector('input');
input.onKeyPress.listen((data) {
final customKeypress = CustomEvent('keypress', detail: {
'keyCode': data.keyCode,
'charCode': data.charCode,
input.on['keypress'].listen((data) {
print('Heyyy! ${(data as CustomEvent).detail['keyCode']}');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment