scroll method
Scrolls this element in x and/or y direction by pixels.
ScrollOptions is currently not supported. https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll
Implementation
@override
Future<void> scroll({int? x, int? y}) async {
await syncFn(() => _retryWhenStale(() {
final element = _single;
// Note: element.scroll(...) from dart:html does not work.
return _microtask(() {
element.scrollLeft += x ?? 0;
element.scrollTop += y ?? 0;
// In practice, 'scroll' events are sent rapidly but we only send
// it once here.
element.dispatchEvent(Event('scroll'));
});
}));
}