List<int> mainList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16];
List<int> chukLengths= [2,4,4,4,2]
Expected Result:
[[1,2],[3,4,5,6],[7,8,9,10],[11,12,13,14],[15,16]]
I wanna split mainList to 5 chunks with mentioned chunkLength. How to resolve it in Dart?