moveToElementCenter method Null safety

void moveToElementCenter(
  1. WebElement element,
  2. {int? xOffset,
  3. int? yOffset}
)

Moves to element, with an offset of xOffset and yOffset based on the center of element.

Implementation

void moveToElementCenter(WebElement element, {int? xOffset, int? yOffset}) {
  if (_handler is JsonWireWebDriverHandler) {
    final size = element.size;
    moveTo(
        element: element,
        xOffset: (xOffset ?? 0) + size.width ~/ 2,
        yOffset: (yOffset ?? 0) + size.height ~/ 2);
  } else {
    moveTo(element: element, xOffset: xOffset, yOffset: yOffset);
  }
}