measureSync method

  1. @override
Rectangle<num> measureSync(
  1. Element element, {
  2. bool offset = false,
})

Returns a dimension client rectangle for element.

If offset is true, returns the offset positions from the parent instead of absolute.

Throws StateError if element is not within the live DOM.

Implementation

@override
Rectangle measureSync(Element element, {bool offset = false}) {
  // Purposefully don't use a 'canSyncWrite' here because some places in the
  // code will want a synchronous write regardless (e.g. overlays).
  if (offset) {
    return element.offset;
  }
  return element.getBoundingClientRect();
}