operator + method

SlotTimeUnit operator +(
  1. int other
)

Adds other to this SlotTimeUnit and returns the resulting SlotTimeUnit.

Implementation

SlotTimeUnit operator +(int other) {
  final newIndex = index + other;

  if (newIndex < 0 || newIndex >= SlotTimeUnit.values.length) {
    throw RangeError('SlotTimeUnit index out of bounds: $newIndex. Must be between 0 and ${SlotTimeUnit.values.length - 1}');
  }

  return SlotTimeUnit.values[newIndex];
}