title: RangeError (index): Invalid value: Valid value range is empty: 0
body: <p>I am trying to fetch a list from API that is two methods fetchImages and fetchCategories. the first time it is showing a red screen error and then after 2 seconds automatically it is loading the list. Can you please tell me what's the issue with my code and how to avoid showing that red screen error in my app?</p>
  <pre><code>Widget build(context) {
      try{
        if (isFirst == true) {
          fetchImage();
          fetchCategories(context);
          isFirst = false;
        }
      }catch(Exception){
  
      }
  
      return MaterialApp(
        home: Scaffold(
          backgroundColor: Colors.black,
          appBar: AppBar(
            title: Text('Lets see images!'),
          ),
          body: new Column(
            children: &lt;Widget&gt;[
              new Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: &lt;Widget&gt;[
                  new InkResponse(
                      child: new Column(
                        children: &lt;Widget&gt;[
                          Padding(
                            padding: EdgeInsets.all(10.0),
                            child: new Image.asset(
                              catimages[0],
                              width: 60.0,
                              height: 60.0,
                            ),
                          ),
                          new Text(
                            categoriesText[0],
                            style: TextStyle(color: Colors.white),
                          ),
                        ],
                      ),
                      onTap: () {
                        debugPrint(&quot;on tv clikced&quot;);
                        widget.fetchApI.fetchSubCategories(context, 6);
                      }),
                  new InkResponse(
                    child: new Column(
                      children: &lt;Widget&gt;[
                        Padding(
                          padding: EdgeInsets.all(10.0),
                          child: new Image.asset(
                            catimages[1],
                            width: 60.0,
                            height: 60.0,
                          ),
                        ),
                        new Text(
                          categoriesText[1],
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                    onTap: () {
                      debugPrint(&quot;on moview clicked&quot;);
                      widget. fetchApI.fetchSubCategories(context, 7);
                    },
                  ),
                  new InkResponse(
                    child: new Column(
                      children: &lt;Widget&gt;[
                        Padding(
                          padding: EdgeInsets.all(10.0),
                          child: new Image.asset(
                            catimages[2],
                            width: 60.0,
                            height: 60.0,
                          ),
                        ),
                        new Text(
                         categoriesText[2],
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                    onTap: () {
                      debugPrint(&quot;on news clicked&quot;);
                      widget.fetchApI.fetchSubCategories(context, 10);
                    },
                  ),
                  new InkResponse(
                    child: new Column(
                      children: &lt;Widget&gt;[
                        Padding(
                          padding: EdgeInsets.all(10.0),
                          child: new Image.asset(catimages[3],
                              width: 60.0, height: 60.0),
                        ),
                        new Text(
                          categoriesText[3],
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                    onTap: () {
                      debugPrint('on shows clicked');
                      widget.fetchApI.fetchSubCategories(context, 8);
                    },
                  ),
                  new InkResponse(
                    child: new Column(
                      children: &lt;Widget&gt;[
                        Padding(
                          padding: EdgeInsets.all(10.0),
                          child: new Image.asset('assets/live_icon.png',
                              width: 60.0, height: 60.0),
                        ),
                        new Text(
                          'Live',
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                    onTap: () {
                      debugPrint('on live clicked');
                    },
                  ),
                ],
              ),
              ImageList(images,widget.fetchApI),
            ],
          ),
        ),
      );
    }
  </code></pre>