toJson method

Map<String, dynamic> toJson()

Convert to JSON map for JS serialization.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'hwMeta': hwMeta.toJson(),
      'direction': direction,
      'properties': {'side': side, 'index': index},
      if (children.isNotEmpty)
        'children': children.map((c) => c.toJson()).toList(),
      if (x != null) 'x': x,
      if (y != null) 'y': y,
      if (width != null) 'width': width,
      if (height != null) 'height': height,
    };