flipAxisDirection function Null safety

AxisDirection flipAxisDirection(
  1. AxisDirection axisDirection
)

Returns the opposite of the given AxisDirection.

Specifically, returns AxisDirection.up for AxisDirection.down (and vice versa), as well as AxisDirection.left for AxisDirection.right (and vice versa).

See also:

Implementation

AxisDirection flipAxisDirection(AxisDirection axisDirection) {
  assert(axisDirection != null);
  switch (axisDirection) {
    case AxisDirection.up:
      return AxisDirection.down;
    case AxisDirection.right:
      return AxisDirection.left;
    case AxisDirection.down:
      return AxisDirection.up;
    case AxisDirection.left:
      return AxisDirection.right;
  }
}