scrollTo method Null safety

Future<void> scrollTo(
  1. {required int x,
  2. required int y,
  3. bool animated = false}
)

Scrolls the WebView to the position.

x represents the x position to scroll to.

y represents the y position to scroll to.

animated true to animate the scroll transition, false to make the scoll transition immediate.

Official Android API: https://developer.android.com/reference/android/view/View#scrollTo(int,%20int)

Official iOS API: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset

Implementation

Future<void> scrollTo(
    {required int x, required int y, bool animated = false}) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('x', () => x);
  args.putIfAbsent('y', () => y);
  args.putIfAbsent('animated', () => animated);
  await _channel.invokeMethod('scrollTo', args);
}