title: Access and modify parameter from another class
body: <p>I'm starting in flutter development by trying to build a simple ToDo app from scratch, not based on any tutorials, so I can learn better, but now I'm having trouble accessing the todos array from the equivalent widget...</p>
  
  <p>to get things organized i have the structure:</p>
  
  <pre><code>lib
    pages
      home.page.dart
    widgets
      todo-card.dart
      todo-empty.dart
    main.dart
  </code></pre>
  
  <p>the app is a list of cards for each todo and a FAB for creating a new one. Each card is a delete button, part of the todo's text and a check button. All of the todos items are stored in the HomePage class:</p>
  
  <p><strong>pages/home.page.dart</strong></p>
  
  <pre><code>class HomePage extends StatefulWidget {
    @override
    _HomePageState createState() =&gt; _HomePageState();
  }
  
  class _HomePageState extends State&lt;HomePage&gt; {
    List todos = [
      {'text': 'texto teste 1', 'checked': false},
      {'text': 'texto teste 2', 'checked': true},
      {'text': 'texto teste 3', 'checked': false},
    ];
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          ...
        ),
        backgroundColor: Theme.of(context).primaryColor,
        body: this.todos.length &gt; 0
            ? ListView.builder(
                itemCount: this.todos.length,
                itemBuilder: (context, index) {
                  Map item = this.todos[index];
  
                  return TodoCard(item['text'], item['checked']);
                },
              )
            : TodoEmpty(),
        floatingActionButton: FloatingActionButton(
          ...
        ),
      );
    }
  }
  </code></pre>
  
  <p>And the card structure:
  <strong>widgets/todo-card.dart</strong></p>
  
  <pre><code>class TodoCard extends StatefulWidget {
    String text;
    bool checked = false;
  
    TodoCard(this.text, [this.checked = false]);
  
    @override
    _TodoCardState createState() =&gt; _TodoCardState();
  }
  
  class _TodoCardState extends State&lt;TodoCard&gt; {
    @override
    Widget build(BuildContext context) {
      return Card(
        child: Container(
          padding: EdgeInsets.all(20),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: &lt;Widget&gt;[
              IconButton(
                icon: Icon(Icons.delete),
                onPressed: () {
  
                },
              ),
              Expanded(
                child: Text(
                  widget.text,
                ),
              ),
              IconButton(
                icon: widget.checked
                    ? Icon(Icons.check_box)
                    : Icon(Icons.check_box_outline_blank),
                onPressed: () {
                  setState(() {
                    if (widget.checked == true) {
                      widget.checked = false;
                    } else {
                      widget.checked = true;
                    }
                  });
                },
              ),
            ],
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>my question is: <strong>how can I access and delete <code>HomePage</code> properties from <code>TodoCard</code> class, so I can delete the index from the <code>todos</code> List?</strong></p>
  
  <p>For now I don't want to use bloc, provider or other similar tools. Since I'm getting started with Flutter I'd like to master <code>setState()</code> first. </p>
  
  <p><a href="https://github.com/gabrielcesar95/todo" rel="nofollow noreferrer">Project repository on Github</a></p>