Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use EventStreamProvider because ElementStream is not published. #199

Open
ditman opened this issue Mar 6, 2024 · 2 comments
Open

Comments

@ditman
Copy link
Member

ditman commented Mar 6, 2024

I'm trying to listen to the cancel event of an HTMLInputElement, and instead of using the .oncancel setter directly:

I'm trying to add an onCancel stream to an web.HTMLInputElement with something like the following:

extension AddOnCancelStreamToInputElement on web.HTMLInputElement {
  web.ElementStream<web.Event> get onCancel => const
    web.EventStreamProvider<web.Event>('cancel').forElement(this);
}

However, I get the following error:

Undefined class 'ElementStream'.
Try changing the name to the name of an existing class, or creating a class with the name 'ElementStream'. dart(undefined_class)

2 questions here:

  1. Can an onCancel Stream be added to the HTMLInputElement class somewhere here.
  2. and/or expose the ElementStream<T> so I can add my own with the same helpers available for package:web.
@ditman
Copy link
Member Author

ditman commented Mar 6, 2024

(Am I supposed to use this differently, though?)

@CEksal
Copy link

CEksal commented Mar 7, 2024

If you don't need to use ElementStream#capture, you can use Stream<web.Event> instead (since ElementStream<web.Event> implements that interface).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants