operator [] method

double operator [](
  1. int index
)

Implementation

double operator [](int index) {
  switch (index) {
    case 0:
      return x;
    case 1:
      return y;
    default:
      throw RangeError.index(index, [x, y], 'index');
  }
}