next method

void next({
  1. bool loop = true,
})

Sets the next value of the state. If loop is set to true, this method does nothing if the current value is the next.

Implementation

void next({bool loop = true}) {
  if (_index + 1 < _values.length) {
    value = _values[_index + 1];
  } else if (loop) {
    value = _values.first;
  }
}