title: NoSuchMethodError: invalid member on null (Flutter Web)
body: <p>I am making a Card list that gets data from a Firestore database for a Flutter Web application, but this error is thrown: </p>
  
  <pre><code> - "The following JSNoSuchMethodError was thrown building
     UserList(dirty, dependencies: [InheritedProvider&lt;List&lt;ClientUser&gt;&gt;],
     state: _UserListState#ab779): NoSuchMethodError: invalid member on
     null: 'length'"
  </code></pre>
  
  <p>Here is the code that I am using to build the list:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class _UserListState extends State&lt;UserList&gt; {
    @override
    Widget build(BuildContext context) {
      final users = Provider.of&lt;List&lt;ClientUser&gt;&gt;(context);
  
      return ListView.builder(
        itemBuilder: (context, index) {
          return UserTile(user: users[index]);
        },
        itemCount: users.length,
      );
    }
  </code></pre>
  
  <p>In my database service file, here is how I get the snapshot from the database and get the list from the snapshot:</p>
  
  <pre class="lang-dart prettyprint-override"><code>List&lt;ClientUser&gt; _clientListFromSnapshot(QuerySnapshot snapshot) {
    return snapshot.documents.map((doc) {
      return ClientUser(
          name: doc.data['name'] ?? '', difficulty: doc.data['difficulty'] ?? 5);
    }).toList();
  }
  
  // get users stream
  Stream&lt;List&lt;ClientUser&gt;&gt; get users {
    return userCollection.snapshots().map(_clientListFromSnapshot);
  }
  
  </code></pre>
  
  <p>Here is how I declare the StreamProvider:</p>
  
  <pre class="lang-dart prettyprint-override"><code>return StreamProvider&lt;List&lt;ClientUser&gt;&gt;.value(
        value: UserDatabaseService().users,
  </code></pre>
  
  <p>Where am I going wrong??</p>