toWire method

Map<String, dynamic> toWire()

Backend-bound representation.

Implementation

Map<String, dynamic> toWire() => {
      'id': stableId,
      'role': role,
      if (text.isNotEmpty) 'text': text,
      if (normalizedText.isNotEmpty && normalizedText != text.toLowerCase())
        'normalized_text': normalizedText,
      'bounds': [
        bounds.left.round(),
        bounds.top.round(),
        bounds.right.round(),
        bounds.bottom.round(),
      ],
      if (scrollable) 'scrollable': true,
      'visible': visible,
      'visible_fraction': wireVisibleFraction,
      if (layer > 0) 'layer': layer,
      if (hasAction) 'has_action': true,
      if (identifier.isNotEmpty) 'identifier': identifier,
      if (parentId.isNotEmpty) 'parent_id': parentId,
      if (actions.isNotEmpty) 'actions': actions,
      if (wireSubtreeText != null) 'subtree_text': wireSubtreeText,
      if (selected) 'selected': true,
      if (value.isNotEmpty && !secure) 'value': value,
      if (checked != null)
        'checked': checked == 'mixed' ? 'mixed' : checked == 'true',
      if (editable) 'editable': true,
      if (secure) 'secure': true,
      if (disabled != null) 'disabled': disabled,
      if (placeholder.isNotEmpty) 'placeholder': placeholder,
      if (range != null) 'range': range!.toWire(),
    };