title: RangeError (RangeError (index): Invalid value: Not in inclusive range 0..1: 2) flutter when using more than two expanded panel lists
body: <p>please what am i doing wrong here. i am trying to have a listview in an expanded panel list and if i rendered just two expanded list the code runs with no error. but if i rendered more than two, and i try to expand any of the other panel list, it returns the following error as RangeError (RangeError (index): Invalid value: Not in inclusive range 0..1: 2.</p>
  <p>bellow is my code sample. thank you all.</p>
  <pre><code>                        ExpansionPanelList(
                            children: [
                              ExpansionPanel(
                                isExpanded: _isOpen[0],
                                headerBuilder: (context, isOpen) {
                                  return Row(
                                    children: [
                                      SizedBox(width: 10.w),
                                      Center(
                                        child: Text(
                                          &quot;Ball Games ⚽ &quot;,
                                          style: TextStyle(
                                              fontSize: 17.sp,
                                              fontWeight: FontWeight.w400,
                                              color: Color(0xff333333)),
                                        ),
                                      ),
                                    ],
                                  );
                                },
                                body: SingleChildScrollView(
                                  child: Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      _myListView(),
                                      // _myListView(),
                                    ],
                                  ),
                                ),
                              ),
                              ExpansionPanel(
                                isExpanded: _isOpen[1],
                                headerBuilder: (context, isOpen) {
                                  return Row(
                                    children: [
                                      SizedBox(width: 10.w),
                                      Center(
                                        child: Text(
                                          &quot;Racket &amp; Bat &quot;,
                                          style: TextStyle(
                                              fontSize: 17.sp,
                                              fontWeight: FontWeight.w400,
                                              color: Color(0xff333333)),
                                        ),
                                      ),
                                    ],
                                  );
                                },
                                body: SingleChildScrollView(
                                  child: Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      _myListView(),
                                      // _myListView(),
                                    ],
                                  ),
                                ),
                              ),
                              ExpansionPanel(
                                isExpanded: _isOpen[1],
                                headerBuilder: (context, isOpen) {
                                  return Row(
                                    children: [
                                      SizedBox(width: 10.w),
                                      Center(
                                        child: Text(
                                          'Winter ',
                                          style: TextStyle(
                                              fontSize: 17.sp,
                                              fontWeight: FontWeight.w400,
                                              color: Color(0xff333333)),
                                        ),
                                      ),
                                    ],
                                  );
                                },
                                body: SingleChildScrollView(
                                  child: Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      _myListView(),
                                      // _myListView(),
                                    ],
                                  ),
                                ),
                              ),
                              ExpansionPanel(
                                isExpanded: _isOpen[1],
                                headerBuilder: (context, isOpen) {
                                  return Row(
                                    children: [
                                      SizedBox(width: 10.w),
                                      Center(
                                        child: Text(
                                          'Water ‍♀️ ',
                                          style: TextStyle(
                                              fontSize: 17.sp,
                                              fontWeight: FontWeight.w400,
                                              color: Color(0xff333333)),
                                        ),
                                      ),
                                    ],
                                  );
                                },
                                body: SingleChildScrollView(
                                  child: Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      _myListView(),
                                      // _myListView(),
                                    ],
                                  ),
                                ),
                              ),
                              ExpansionPanel(
                                isExpanded: _isOpen[1],
                                headerBuilder: (context, isOpen) {
                                  return Row(
                                    children: [
                                      SizedBox(width: 10.w),
                                      Center(
                                        child: Text(
                                          'Others ',
                                          style: TextStyle(
                                              fontSize: 17.sp,
                                              fontWeight: FontWeight.w400,
                                              color: Color(0xff333333)),
                                        ),
                                      ),
                                    ],
                                  );
                                },
                                body: SingleChildScrollView(
                                  child: Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      _myListView(),
                                      // _myListView(),
                                    ],
                                  ),
                                ),
                              ),
                            ],
                            expansionCallback: (i, isOpen) {
                              setState(() {
                                _isOpen[i] = !isOpen; //this is where the error is pointing to
                              });
                            },
  </code></pre>
  <p>here is the listview i am returning in the expanded panel's body</p>
  <pre><code>Widget _myListView() {
      return MediaQuery.removePadding(
        context: context,
        removeTop: true,
        child: ListView(
          shrinkWrap: true,
          physics: ScrollPhysics(),
          children: List1.keys.map((String key) {
            return new CheckboxListTile(
              title: new Text(key),
              value: List1[key],
              activeColor: Colors.black,
              checkColor: Colors.white,
              onChanged: (bool? value) {
                setState(() {
                  List1[key] = value!;
                });
              },
            );
          }).toList(),
        ),
      );
    }
  </code></pre>
  <p>list1</p>
  <pre><code>
    Map&lt;String, bool&gt; List1 = {
      'Bubble Football ⚽': false,
      'Futsal ': false,
      'Beach Volleyball ': false,
      'Volleyball ': false,
      'Dodgeball ': false,
      'Rugby ': false,
      'American Footbal ': false,
      'Korftbal ': false,
      'Netbal ⚾': false,
    };
  
    List&lt;bool&gt; _isOpen = [true, false];
  </code></pre>
  <p>thanks.</p>