title: Flutter StreamProvider returning null despite stream returning objects
body: <p>I'm try to set up a profile type page where users can view their information and eventually I'll add features so they can change their data. I'm using Provider to access a Firebase stream <code>&lt;User&gt;</code> which returns the current user's UID (this is working fine). The UID is then used to access their <code>&lt;UserData&gt;</code> stream, but when I try and print <code>UserData().email</code> or any other bits of data it just returns null. The code is as follows:</p>
  
  <pre><code>class Profile extends StatefulWidget {
    @override
    _ProfileState createState() =&gt; _ProfileState();
  }
  
  class _ProfileState extends State&lt;Profile&gt; {
    @override
    Widget build(BuildContext context) {
  
      final user = Provider.of&lt;User&gt;(context);
  
      return StreamProvider&lt;UserData&gt;.value(
        initialData: UserData.initialData(),
        value: DatabaseService(uid: user.uid).userData,
        child: Scaffold(
          appBar: AppBar(),
          drawer: NavigationDrawer(),
          body: ListView(
            children: &lt;Widget&gt;[
              ListTile(
                title: Text(UserData().email),
              )
            ],
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>The stream itself looks like this:</p>
  
  <pre><code>  UserData _userDataFromSnapshot(DocumentSnapshot snapshot) {
      return UserData(
        uid: uid,
        email: snapshot.data['email'],
        firstName: snapshot.data['firstName'],
        lastName: snapshot.data['lastName'],
        phone: snapshot.data['phone'],
        dateCreated: snapshot.data['dataCreated'],
        isVerified: snapshot.data['isVerified']
      );
    }
  
    //User data stream
    Stream&lt;UserData&gt; get userData {
      return userDataCollection.document(uid).snapshots()
          .map(_userDataFromSnapshot);
    }
  </code></pre>
  
  <p>And the UserData class is just this</p>
  
  <pre><code>class UserData {
  
    final String uid;
    final String email;
    final String firstName;
    final String lastName;
    final String phone;
    final DateTime dateCreated;
    final bool isVerified;
  
    UserData({ this.uid, this.email, this.firstName, this.lastName, this.phone, this.dateCreated, this.isVerified });
  
    factory UserData.initialData() {
      return UserData(
        uid: '',
        email: '',
        firstName: '',
        lastName: '',
        phone: '',
        dateCreated: null,
        isVerified: null,
      );
    }
  }
  </code></pre>
  
  <p>And finally this is the error I'm getting from the ListTile because <code>UserData().email</code> is null, not a string:</p>
  
  <pre><code>A non-null String must be provided to a Text widget.
  'package:flutter/src/widgets/text.dart':
  Failed assertion: line 285 pos 10: 'data != null'
  </code></pre>
  
  <p>I thought it may have been an issue with the data not loading in time so when Flutter tries to build the page the data isn't there, but adding the <code>UserData.initialData</code> didn't seem to help. I have managed to get it working using StreamBuilder instead however I don't whether using that is best practice or if I should just do everything with Provider so any help wold be appreciated.</p>
  
  <p>Thanks</p>