query function

Element? query(
  1. String selector
)

Queries for an element within the component's shadow root.

This is a stub for user @Component source files. The generated code extends SparkComponentWebComponent, where the instance method WebComponent.query shadows this top-level function automatically.

@Component(tag: 'my-widget')
class MyWidget {
  Element render() {
    return button(onClick: (_) {
      final el = query('#greeting'); // just works
    }, ['Click']);
  }
}

Implementation

web.Element? query(String selector) => null;