title: how to get a list of files from the directory and pass it to the ListView?
body: <p>I get the list of files from the user's folder. The names of the files I transfer to the ListView.builder. It's work, but I think, this is bad architecture. </p>
  
  <p>A method _getFilesFromDir() call with a high frequency.</p>
  
  <p>How to make the correct list generation, so as not to update the interface without changing the file list?</p>
  
  <pre><code>class CharacteristList extends StatefulWidget {
    @override
    _CharacteristListState createState() =&gt; new _CharacteristListState();
  }    
  class _CharacteristListState extends State&lt;CharacteristList&gt; {
    List&lt;String&gt; filesList = new List&lt;String&gt;();
    List&lt;String&gt; filesL = new List&lt;String&gt;();
    @override    
    void initState() {
      super.initState();
      filesList = [];
    }    
    Future&lt;List&lt;String&gt;&gt; _getFilesFromDir() async{
      filesL = await FilesInDirectory().getFilesFromDir();
      setState(() {
        filesList = filesL;
      });
      return filesList;
    }    
    _getFilesCount(){
      _getFilesFromDir();
      int count = filesList.length;
      return count;
    }    
    @override
    Widget build(BuildContext context) {    
      return new Scaffold(
        appBar: new AppBar(
          title: const Text('Список документов'),
        ),
        body: new Column(
          children: &lt;Widget&gt;[
            new Expanded(
                child: new ListView.builder(
                  //TODO не успевает сформировать список файлов
                  itemCount: _getFilesCount(),
                  itemBuilder: (context, index){
                    return new CharacteristListItem(filesList[index]);
                  },
                ),
            ),
          ],
        ),
        floatingActionButton: new FloatingActionButton(
          onPressed: () {
            Navigator.push(context,
                new MaterialPageRoute(builder: (context)
            =&gt; new StartScreen()),
            );},
          child: new Icon(Icons.add),
        ),
      );
    }    
  }
  </code></pre>