getBorder function Null safety

Map<String, dynamic> getBorder(
  1. String key,
  2. Map<String, dynamic> v,
  3. dynamic value
)

Implementation

Map<String, dynamic> getBorder(String key, Map<String, dynamic> v, value) {
  BorderStyle borderStyle = value["borderStyle"] ?? BorderStyle.solid;
  Color color = value["borderColor"] ?? Colors.transparent;

  // TODO :: NEED TO ADD COLOR PROPS FOR ALL SIDE BORDER

  v.addAll({
    key: Border(
      left: BorderSide(
        width: value["borderLeft"] ?? value["borderWidth"] ?? 0,
        style: borderStyle,
        color: color,
      ),
      right: BorderSide(
        width: value["borderRight"] ?? value["borderWidth"] ?? 0,
        style: borderStyle,
        color: color,
      ),
      top: BorderSide(
        width: value["borderTop"] ?? value["borderWidth"] ?? 0,
        style: borderStyle,
        color: color,
      ),
      bottom: BorderSide(
        width: value["borderBottom"] ?? value["borderWidth"] ?? 0,
        style: borderStyle,
        color: color,
      ),
    )
  });
  return v;
}