window function

Iterable<List<num>> window (
  1. List<num> data,
  2. int size,
  3. {bool includePartial: false}
)

Implementation

Iterable<List<num>> window(List<num> data, int size,
    {bool includePartial = false}) sync* {
  int start = 0;
  int end = 0;
  if (includePartial) {
    end = 1;
    start = end - size;
  } else {
    start = 0;
    end = size;
  }
  while (end <= data.length) {
    yield data.sublist(max(start, 0), end);
    start++;
    end++;
  }
  return;
}