toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() => <String, Object?>{
  "id": id,
  "kind": kind.name,
  if (pageIndex >= 0) "page": pageIndex,
  if (blockIndex >= 0) "block": blockIndex,
  "pts": <double>[
    for (final Offset point in points) ...<double>[_r4(point.dx), _r4(point.dy)],
  ],
  "stroke": strokeColor.toARGB32(),
  if (fillColor != null) "fill": fillColor!.toARGB32(),
  "w": _r4(strokeWidth),
  if (opacity != 1) "o": _r4(opacity),
  if (dashed) "dash": true,
  if (text.isNotEmpty) "text": text,
  if (kind == UDocShapeKind.textBox) "fs": _r4(fontSize),
  if (bold) "bold": true,
  if (startMs != null) "start": startMs,
  if (endMs != null) "end": endMs,
  "created": createdAt.toIso8601String(),
  "updated": updatedAt.toIso8601String(),
};