getContent method

List<List<AdaptiveItem>> getContent(
  1. dynamic maxCount,
  2. List<AdaptiveItem> toCheck
)

Implementation

List<List<AdaptiveItem>> getContent(maxCount, List<AdaptiveItem> toCheck) {
  List<List<AdaptiveItem>> result = [];
  while (result.length < children.length / maxCount.floor()) {
    List<AdaptiveItem> sub = [];
    int temp = 0;
    while (sub.length < maxCount) {
      try {
        sub.add(toCheck[temp]);
        toCheck.removeAt(temp);
      } catch (e) {
        break;
      }
    }
    result.add(sub);
  }
  return result;
}