title: Flutter Dart: how can I change the value of a class property in a list of Classes
body: <p>Hello I am having issue to understand how to manage properties of a class when it is part of a list of classes </p>
  
  <p>Here are my classes</p>
  
  <pre><code>class BasketItem {
    final String itemDescription;
    final String itemNote;
  
    BasketItem(
        {this.itemDescription,
        this.itemNote});
  }
  
  class AppData {
    static final AppData _appData = new AppData._internal();
  
    List&lt;BasketItem&gt; basketList = [];
    factory AppData() {
      return _appData;
    }
    AppData._internal();
  }
  
  final appData = AppData();
  </code></pre>
  
  <p>And here is my List </p>
  
  <pre><code>List&lt;Container&gt; _buildBasketList() {
      return appData.basketList.map((bList) {
        var container = Container(
          child: Builder(
            builder: (context) =&gt; Dismissible(
              key: Key(UniqueKey().toString()),
              background: Container(
                margin: EdgeInsets.all(8.0),
                color: kColorAccent,
                child: Align(
                    alignment: Alignment(-0.90, 0.00),
                    child: Icon(Icons.add_comment)),
              ),
              onDismissed: (direction) {
                  final newItemToAdd = BasketItem(
                      itemDescription: bList.itemDescription,
                      itemNote: 'xxxxx',);
  
                  appData.basketList.add(newItemToAdd);
  
                  setState(() {});
                  appData.basketList.remove(bList);
  
              },
              child: Stack(...)
            ),
          ),
        );
        return container;
      }).toList();
    }
  </code></pre>
  
  <p>I would like to do the following: when <code>onDismissed</code> get executed I would like to amend the property <code>itemNote</code> to 'xxxxx'. How can I do it? At the moment I remove the BasketItem I have swiped and I create a new BasketItem and I add it to the list. The problem is that this does not seem efficient and it also add the item at the end of the list while I would like to keep it at the same position/index where it was.</p>
  
  <p>Thanks</p>