borderToJson static method

Map<String, dynamic>? borderToJson(
  1. Border? source
)

Implementation

static Map<String, dynamic>? borderToJson(Border? source) {
  if (source == null) return null;
  final x = {
    if (source.left != BorderSide.none) "left": source.left,
    if (source.right != BorderSide.none) "right": source.right,
    if (source.top != BorderSide.none) "top": source.top,
    if (source.bottom != BorderSide.none) "bottom": source.bottom
  }.map((k, v) {
    return MapEntry(k, {
      "color": StyleParser.colorToHex(v.color),
      "width": v.width,
      "style": v.style.name,
      "strokeAlign": v.strokeAlign,
    });
  });
  if (x.isEmpty) return null;
  return x;
}