title: Flutter error: The following NoSuchMethodError was thrown building
body: <p>I'm new to flutter, and I've got an error everytime I run the application:</p>
  <pre><code>══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  The following NoSuchMethodError was thrown building DataList(dirty, dependencies:
  [_InheritedProviderScope&lt;List&lt;Store&gt;&gt;], state: _DataListState#67e37):
  The getter 'length' was called on null.
  Receiver: null
  Tried calling: length
  The relevant error-causing widget was:
    DataList
  </code></pre>
  <p>Here is my DataList file:</p>
  <pre><code>class DataList extends StatefulWidget {
    @override
    _DataListState createState() =&gt; _DataListState();
  }
  
  class _DataListState extends State&lt;DataList&gt; {
    @override
    Widget build(BuildContext context) {
      final stores = Provider.of&lt;List&lt;Store&gt;&gt;(context);
  
      // stores.forEach((d) {
      //   print(d.name);
      // });
  
      return ListView.builder(
        itemCount: stores.length,
        itemBuilder: (context, index) {
          return StoreTile(store: stores[index]);
        },
      );
    }
  }
  </code></pre>
  <p>This happens after I login and display a list of stores.
  I've printed <code>stores.length</code> and it returns 6, but for whatever reason the app finds a <code>null</code> and throws an error.</p>
  <p>Note that the screen on the app is displayed correctly, but in the Debug Console I get this error.</p>
  <p>Any help is appreciated
  Joe</p>