merge method

Creates a copy of this ToggleIconStyle but with the given fields replaced with the new values.

Implementation

ToggleIconStyle merge(ToggleIconStyle? other) {
  // if null return current object
  if (other == null) return this;

  var style = copyWith(
    size: other.size,
    color: other.color,
    opacity: other.opacity,
    scale: other.scale,
    backColor: other.backColor,
    backOpacity: other.backOpacity,
  );

  if (other is DrivenToggleIconStyle) {
    style = style.copyWith(
      selectedStyle: other.selectedStyle,
      disabledStyle: other.disabledStyle,
      mergeResolved: other.mergeResolved,
    );
  }

  return style;
}