merge method
Merges this object with other, returning a new object of type T.
Implementation
@override
BoxBorderDto merge(BoxBorderDto? other) {
if (other == null) return this;
final type = checkMergeType(other);
assert(type != null, 'Cannot merge Border with BoxBorderDirectional');
if (type == Border) {
return BoxBorderDto(
top: top?.merge(other.top) ?? other.top,
bottom: bottom?.merge(other.bottom) ?? other.bottom,
left: left?.merge(other.left) ?? other.left,
right: right?.merge(other.right) ?? other.right,
);
}
if (type == BorderDirectional) {
return BoxBorderDto(
top: top?.merge(other.top) ?? other.top,
bottom: bottom?.merge(other.bottom) ?? other.bottom,
start: start?.merge(other.start) ?? other.start,
end: end?.merge(other.end) ?? other.end,
);
}
return other;
}