List<List<T>> grouped<T>(List<T> list, int n) { return [ for (var i in range(end: list.length ~/ n)) list.skip(i * n).take(n).toList() ]; }