title: Flutter - Update ListView and reset scroll position
body: <p>I have a ListView, where i change the Items in the List by clicking a button. Problem now is, that when i scroll down to the end of the list then click the Button, the Items change but the position of the list is still the same (so when i scrolled down and item #2 of my previous list was at the top, then item #2 of the new list will also be at the top).
  What i want is that the List starts at the top again and i have to scroll down again.</p>
  
  <p>my main.dart:</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatefulWidget {
    @override
    _MyAppState createState() =&gt; _MyAppState();
  }
  
  class _MyAppState extends State&lt;MyApp&gt; {
    List _list;
    List _list1 = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'];
    List _list2 = ['Element A', 'Element B', 'Element C', 'Element D', 'Element E', 'Element F'];
    bool _isList1;
  
    @override
    void initState() {
      _list = _list1;
      _isList1 = true;
      super.initState();
    }
  
    void _changeList() {
      setState(() {
        if (_isList1) {
          _list = _list2;
          _isList1 = false;
        } else {
          _list = _list1;
          _isList1 = true;
        }
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
          title: 'Schürer',
          home: Scaffold(
            appBar: AppBar(
              title: Text('ListView'),
            ),
            body: Column(
              children: &lt;Widget&gt;[
                RaisedButton(
                  child: Text("Change List"),
                  onPressed: _changeList,
                ),
                Expanded(
                  child: ListView(
                    children: _list
                        .map(
                          (item) =&gt; Card(
                                child: Container(
                                  padding: EdgeInsets.all(50),
                                  color: Colors.black26,
                                  child: Text(item),
                                ),
                              ),
                        )
                        .toList(),
                  ),
                ),
              ],
            ),
          ));
    }
  }
  </code></pre>