createLimit<T> method
Implementation
List<List<T>> createLimit<T>({
required int limit,
}) {
List<List<T>> result = [];
List<T> state_data = [];
for (var i = 0; i < length; i++) {
dynamic data_id = this[i];
if (data_id is T == false) {
continue;
}
if (state_data.length >= limit) {
state_data.add(data_id);
result.add(state_data);
state_data = [];
} else {
state_data.add(data_id);
}
}
if (state_data.isNotEmpty) {
result.add(state_data);
state_data = [];
}
return result;
}