title: This class (or a class which this class inherits from) is marked as '@imutable' but one or more of its instance fields are not final
body: <p>I get this warning in Android Studio in <strong>stateless</strong> widget</p>
  
  <blockquote>
    <p>This class (or a class which this class inherits from) is marked as
    '@imutable' but one or more of its instance fields are not final</p>
  </blockquote>
  
  <p>when I want to create variable outside of build method. How do I get rid of this warning... or am I doing something wrong?</p>
  
  <p><strong>Replicable code</strong></p>
  
  <pre><code>class TestScreen extends StatelessWidget {
    final List&lt;Map&lt;String, dynamic&gt;&gt; list = [
      {'id': 1, 'name': 'name1'},
      {'id': 2, 'name': 'name2'}
    ];
    List&lt;int&gt; _ids = [];
    @override
    Widget build(BuildContext context) {
      _ids.clear();
      return Scaffold(
        body: Column(
          children: &lt;Widget&gt;[
            Expanded(
              child: ListView.builder(
                  itemCount: list.length,
                  itemBuilder: (BuildContext context, int index) {
                    _ids.add(list[index]['id']);
                    return ListTile(
                      title: Text(list[index]['name']),
                    );
                  }),
            ),
            FlatButton(
              child: Text('Print all ids'),
              onPressed: () {
                print(_ids.toString());
              },
            )
          ],
        ),
      );
    }
  }
  </code></pre>
  
  <p><strong>peace of that warning message</strong></p>
  
  <p><a href="https://i.stack.imgur.com/fYW1h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fYW1h.png" alt="enter image description here"></a></p>