title: Flutter: Index out of range
body: <p>I'm trying to add a dynamic slider. I tried different ways to implement this slide that I wanted to create. When I try to use that code I'm getting an error:
  <strong>RangeError (index): Index out of range: index should be less than 75: 75</strong>. I don't why. But when I change <code>category[count]</code> to <code>category[i]</code> error is gone but same value repeats.</p>
  <pre><code>  Widget build(BuildContext context) {
      final List&lt;Category&gt; category = widget.category;
      int slideLenght = ((category.length / 14).floor()) + 1;
      List&lt;Widget&gt; slides = [];
      List categoryForSlide = [];
      var count = 0;
      for (var i = 0; i &lt; slideLenght; i++) {
        List&lt;Category&gt; subCat = List();
  
        for (var i = 0; i &lt; category.length; i++) {
          if (i == 14) break;
          subCat.add(category[count]);
          print(count);
          count++;
        }
        categoryForSlide.add(subCat);
      }
      print(categoryForSlide.length);
      return Container(),
      );
  </code></pre>