mergeSpaceAttribute<T extends SpaceAttribute> function Null safety

T mergeSpaceAttribute<T extends SpaceAttribute>(
  1. T? attribute,
  2. T other
)

Builder

Implementation

T mergeSpaceAttribute<T extends SpaceAttribute>(T? attribute, T other) {
  assert(T != SpaceAttribute);

  /// Create new object if null
  attribute ??= SpaceAttribute.create<T>();
  return attribute.copyWith(
    left: other.left ?? attribute.left,
    top: other.top ?? attribute.top,
    bottom: other.bottom ?? attribute.bottom,
    right: other.right ?? attribute.right,
  ) as T;
}