title: Flutter : flutter : Unsupported operation: Cannot add to an unmodifiable list
body: <p>I want to program a shopping list app it throws me from line 41 the debug error</p>
  <blockquote>
  <p>&quot;UnsupportedError (Unsupported operation: Cannot add to an unmodifiable list)&quot;.</p>
  </blockquote>
  <p>Source of the Add Button</p>
  <pre><code>ElevatedButton(
                    onPressed: () {
                      shoppingList.add(ShoppingItem(
                          name: _textEditingController.text, done: false));
                      Navigator.pop(context);
                    },
                    child: const Text('Add')
                    ),
  </code></pre>
  <p>the whole source code of the AddShoppingItemScreen</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:shoppinglist/screens/shopping_item.dart';
  import 'config.dart';
  
  class AddShoppingItemScreen extends StatefulWidget {
    const AddShoppingItemScreen({Key? key}) : super(key: key);
  
    @override
    State&lt;AddShoppingItemScreen&gt; createState() =&gt; _AddShoppingItemScreenState();
  }
  
  class _AddShoppingItemScreenState extends State&lt;AddShoppingItemScreen&gt; {
    final TextEditingController _textEditingController =
        TextEditingController(text: '');
  
    @override
    Widget build(BuildContext context) {
      final shoppingList = context
          .dependOnInheritedWidgetOfExactType&lt;Configuration&gt;()!
          .shoppingList;
  
      return Scaffold(
          appBar: AppBar(
            title: const Text('Add Item'),
          ),
          body: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                TextFormField(
                  controller: _textEditingController,
                  autofocus: true,
                  decoration: InputDecoration(
                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(10),
                    ),
                  ),
                ),
                ElevatedButton(
                    onPressed: () {
                      shoppingList.add(ShoppingItem(
                          name: _textEditingController.text, done: false));
                      Navigator.pop(context);
                    },
                    child: const Text('Add')
                    ),
              ],
            ),
          ));
    }
  }
  
  </code></pre>