toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    'direction': direction,
    'type': type,
    'value': type == 'image' || type == 'button' || type == 'video'
        ? value // Serialize as a String for these types.
        : (value as List<Value>).map((v) => v.toJson()).toList(),
    // Serialize as a List<Value> otherwise.
    'fontFamily': fontFamily,
    'fontSize': fontSize,
    'textAlign': textAlign,
    'align': align,
    'backgroundColor': backgroundColor,
    'borderRadius': borderRadius,
    'color': color,
    'fontWeight': fontWeight,
    'paddingX': paddingX,
    'paddingY': paddingY,
    'url': url,
  };
}