operator [] method

  1. @mustCallSuper
Color operator [](
  1. int index
)

Returns a shade color.

Implementation

@mustCallSuper
Color operator [](int index) {
  switch (brightness) {
    case Brightness.light:
      switch (index) {
        case 30:
          return w30;
        case 40:
          return w40;
        case 50:
          return w50;
        case 60:
          return w60;
        case 70:
          return w70;
        case 80:
          return w80;
        case 90:
          return w90;
        case 100:
          return w100;
        default:
          throw Exception('Wrong index for shade color');
      }
    case Brightness.dark:
    default:
      switch (index) {
        case 30:
          return b30;
        case 40:
          return b40;
        case 50:
          return b50;
        case 60:
          return b60;
        case 70:
          return b70;
        case 80:
          return b80;
        case 90:
          return b90;
        case 100:
          return b100;
        default:
          throw Exception('Wrong index for shade color');
      }
  }
}