title: Listview with Checkbox using StatefulWidget(setState)
body: <p>I am trying to develop an app in flutter, that has topics that the user can select and check box state will change when i scroll on listview  check box state will not collapse and  finally user give the submit the value are will bring out.i tried i am not able do that.</p>
  
  <p>the error message shows: 
  The method 'setState' isn't defined for the class 'ItemDepletionList'.
  Try correcting the name to the name of an existing method, or defining a method named 'setState' </p>
  
  <pre><code>class ItemDepletion extends StatefulWidget {
    @override
    _GetShaftsState createState() =&gt; _GetShaftsState();
  
  }
  
  class _GetShaftsState extends State&lt;ItemDepletion&gt; {
    ItemDepletionBloc _bloc;
    String json =
        '{"RECORD_ID": "0", "REQTYPE": "ITEMDEPELTION", "CLINIC_ID": "1012"}';
  
    @override
    void initState() {
      super.initState();
      _bloc = ItemDepletionBloc(json);
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          elevation: 0.0,
          automaticallyImplyLeading: false,
          title: Text('Chucky Categories',
              style: TextStyle(color: Colors.white, fontSize: 20)),
          backgroundColor: Color(0xFF333333),
        ),
        backgroundColor: Color(0xFF333333),
        body: RefreshIndicator(
          onRefresh: () =&gt; _bloc.fetchCategories(json),
          child: StreamBuilder&lt;Response&lt;List&lt;Idepeltion&gt;&gt;&gt;(
            stream: _bloc.chuckListStream,
            builder: (context, snapshot) {
              if (snapshot.hasData) {
                switch (snapshot.data.status) {
                  case Status.LOADING:
                    return Loading(loadingMessage: snapshot.data.message);
                    break;
                  case Status.COMPLETED:
                    return ItemDepletionList(
                        itemdepletionlst: snapshot.data.data);
                    break;
                  case Status.ERROR:
                    return Error(
                      errorMessage: snapshot.data.message,
                      onRetryPressed: () =&gt; _bloc.fetchCategories(json),
                    );
                    break;
                }
              }
              return Container();
            },
          ),
        ),
      );
    }
  
    @override
    void dispose() {
      _bloc.dispose();
      super.dispose();
    }
  }
  
  
  
  class ItemDepletionList extends StatelessWidget {
    // final Itemdepeltion categoryList;
    final List&lt;Idepeltion&gt; itemdepletionlst;
    const ItemDepletionList({Key key, this.itemdepletionlst}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
          appBar: new Myappbar(title: new Text("Home Page")),
          body: Column(children: [
            Expanded(
              child: ListView.builder(
                itemCount: itemdepletionlst.length,
                itemBuilder: (context, index) {
                  return ListTile(
                      title: new Container(
                          child: Row(
                    children: &lt;Widget&gt;[
                      new Checkbox(
                          value: itemdepletionlst[index].isCheck,
                          onChanged: (bool value) {
                           setState(() {
                              itemdepletionlst[index].isCheck = value;
                            });
                          }),
                      new Expanded(
                        child: new Container(
                          padding: new EdgeInsets.only(left: 8.0, right: 8.0),
                          child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: &lt;Widget&gt;[
                              new Text(
                                '${itemdepletionlst[index].itemName}',
                                style: new TextStyle(
                                  color: Colors.black,
                                  fontWeight: FontWeight.w600,
                                  fontSize: 16.0,
                                ),
                              ),
                              new Text(
                                '${itemdepletionlst[index].category}',
                                style: new TextStyle(color: Colors.grey),
                              ),
                            ],
                          ),
                        ),
                      ),
                      new Expanded(
                          child: GestureDetector(
                        onTap: () {
                          selectedItem(
                              context, itemdepletionlst[index].suggQtyUnit);
                        },
                        child: new Container(
                          padding: new EdgeInsets.only(left: 8.0, right: 8.0),
                          child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: &lt;Widget&gt;[
                              new Text(
                                '${itemdepletionlst[index].suggReorderQty} ${itemdepletionlst[index].suggQtyUnit}',
                                style: new TextStyle(
                                  color: Colors.black,
                                  fontWeight: FontWeight.w600,
                                  fontSize: 16.0,
                                ),
                              ),
                              new Text(
                                '${itemdepletionlst[index].manuf}',
                                style: new TextStyle(color: Colors.grey),
                              ),
                            ],
                          ),
                        ),
                      )),
                    ],
                  )));
                },
              ),
            ),
            RaisedButton(
             // onPressed: getCheckboxItems,
              textColor: Colors.white,
              padding: const EdgeInsets.all(0.0),
              child: Container(
                decoration: const BoxDecoration(
                  gradient: LinearGradient(
                    colors: &lt;Color&gt;[
                      Color(0xFF09a3c8),
                      Color(0xFF39B9B4),
                      Color(0xFF0fb188),
                    ],
                  ),
                ),
                padding: const EdgeInsets.all(10.0),
                child: const Text('Submit',
                    style: TextStyle(fontSize: 20, color: Colors.white)),
              ),
            ),
          ])
  
          );
    }
  
  }
  </code></pre>