getComponent method

num getComponent(
  1. int index
)

Implementation

num getComponent(int index) {
  switch (index) {
    case 0:
      return x;
    case 1:
      return y;
    default:
      throw "index is out of range: $index";
  }
}