add method

  1. @override
Border add (
  1. ShapeBorder other,
  2. {bool reversed: false}
)
override

Attempts to create a new object that represents the amalgamation of this border and the other border.

If the type of the other border isn't known, or the given instance cannot be reasonably added to this instance, then this should return null.

This method is used by the operator + implementation.

The reversed argument is true if this object was the right operand of the + operator, and false if it was the left operand.

Implementation

@override
Border add(ShapeBorder other, { bool reversed = false }) {
  if (other is Border &&
      BorderSide.canMerge(top, other.top) &&
      BorderSide.canMerge(right, other.right) &&
      BorderSide.canMerge(bottom, other.bottom) &&
      BorderSide.canMerge(left, other.left)) {
    return Border.merge(this, other);
  }
  return null;
}