add method Null safety

AlignmentGeometry add (
  1. AlignmentGeometry other
)

Returns the sum of two AlignmentGeometry objects.

If you know you are adding two Alignment or two AlignmentDirectional objects, consider using the + operator instead, which always returns an object of the same type as the operands, and is typed accordingly.

If add is applied to two objects of the same type (Alignment or AlignmentDirectional), an object of that type will be returned (though this is not reflected in the type system). Otherwise, an object representing a combination of both is returned. That object can be turned into a concrete Alignment using resolve.

Implementation

AlignmentGeometry add(AlignmentGeometry other) {
  return _MixedAlignment(
    _x + other._x,
    _start + other._start,
    _y + other._y,
  );
}