wrap method

int wrap(
  1. int index
)

Implementation

int wrap(int index) {
  final mod = index % count;
  return mod < 0 ? mod + count : mod;
}