Axis axisDirectionToAxis(AxisDirection axisDirection)

Returns the Axis that contains the given AxisDirection.

Specifically, returns Axis.vertical for AxisDirection.up and AxisDirection.down and returns Axis.horizontal for AxisDirection.left and AxisDirection.right.

Source

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