fromJson method

  1. @override
BoxBorder? fromJson(
  1. Map<String, dynamic>? json
)
override

Implementation

@override
BoxBorder? fromJson(Map<String, dynamic>? json) {
  if (json == null) return null;

  if (json['color'] != null ||
      json['style'] != null ||
      json['width'] != null) {
    var side = const NullableBorderSideConverter().fromJson(json)!;
    return Border.all(
      color: side.color,
      style: side.style,
      width: side.width,
    );
  } else {
    return Border(
      bottom: const NullableBorderSideConverter().fromJson(
            json['bottom'],
          ) ??
          BorderSide.none,
      left: const NullableBorderSideConverter().fromJson(
            json['left'],
          ) ??
          BorderSide.none,
      right: const NullableBorderSideConverter().fromJson(
            json['right'],
          ) ??
          BorderSide.none,
      top: const NullableBorderSideConverter().fromJson(
            json['top'],
          ) ??
          BorderSide.none,
    );
  }
}