chunk method
Gets the current collection (chunk) from the ListGenerator.
Example:
List<int> myList = [1, 2, 3, 4, 5, 6, 7, 8];
ListGenerator<int> generator = ListGenerator.init("numbers", 3, myList);
List<int> currentCollection = generator.collection();
print(currentCollection); // Output: [1, 2, 3]
Implementation
List<T> chunk([int? position]) {
final i = position ?? index;
final data = collections.length > i ? collections[i] : <T>[];
_index++;
return data;
}