createOffset function

(List<int>, int) createOffset({
  1. required int totalCount,
  2. required int limitCount,
})

Implementation

(List<int> offsets, int limit) createOffset({
  required int totalCount,
  required int limitCount,
}) {
  int offset = 0;
  List<int> listOffset = [0];
  for (var i = 0; i < (totalCount ~/ limitCount).toInt(); i++) {
    for (var ii = 0; ii <= limitCount; ii++) {
      if (ii == limitCount) {
        offset = (offset + limitCount);
      }
    }
    listOffset.add(offset);
  }
  return (listOffset, limitCount);
}