resolveElementRect method

Rect? resolveElementRect(
  1. String elementId
)

Resolve an elementId to its on-screen rect (capture-root coords), or null when no node matches. Accepts <type>:<key> (strict) or a bare <key> (matches the first node whose id/text/label/title equals the key regardless of type). Copied from studio_workspace._resolveElementRect.

Implementation

Rect? resolveElementRect(String elementId) {
  final colon = elementId.indexOf(':');
  final String? wantType;
  final String wantKey;
  if (colon < 1) {
    wantType = null;
    wantKey = elementId;
  } else {
    wantType = elementId.substring(0, colon);
    wantKey = elementId.substring(colon + 1);
  }
  final root = _captureRenderBox();
  if (root == null) return null;
  return _findMetaRect(root, root, wantType, wantKey);
}