title: Flutter Firestore NoSuchMethodError
body: <p>I'm developing app with flutter and trying to get data from firestore by using streambuilder method like so.</p>
  
  <pre><code>body: new StreamBuilder&lt;DocumentSnapshot&gt;(
      stream: Firestore.instance.collection('user').document(uid).collection('userInfo').document(uid).snapshots(),
      builder: (BuildContext context, AsyncSnapshot&lt;DocumentSnapshot&gt; snapshot) {
        if (snapshot.connectionState == ConnectionState.waiting) return new Center(child: new CircularProgressIndicator());
        if (snapshot.hasData) {
          return new Center(
          child: ListView(
            shrinkWrap: true,
            padding: EdgeInsets.only(left: 24.0, right: 24.0),
            children: &lt;Widget&gt;[
              new Column(
                children: &lt;Widget&gt;[
                  new CircleAvatar(
                    backgroundColor: Colors.transparent,
                    radius: 48.0,
                    child: Image.asset('assets/logo.png'),
                  ),
                  new Padding(padding: const EdgeInsets.only(bottom: 20.0)),
                  new Text(snapshot.data['name'], 
                  style: new TextStyle(fontSize: 28.0)),
                  new Padding(padding: const EdgeInsets.only(bottom: 35.0)),
                ],
              ),
              new Column(
                children: &lt;Widget&gt;[
                  new Row(
                    children: &lt;Widget&gt;[
                      new Column(
                        children: &lt;Widget&gt;[
                          new Icon(
                            Icons.accessibility,
                            size: 18.0,
                          ),
                          new Text('Age',
                              style: new TextStyle(
                                  fontSize: 12.0, color: Colors.blue)),
                        ],
                      ),
                      new Padding(
                          padding: const EdgeInsets.only(right: 16.0)),
                      new Text(snapshot.data['age'].toString(), style: new TextStyle(fontSize: 25.0)),
                    ],
                  ),
                  new Padding(padding: const EdgeInsets.only(top: 3.0)),
                  new Divider(color: Colors.grey, height: 1.0),
                  new Padding(padding: const EdgeInsets.only(bottom: 25.0)),
                  new Row(
                    children: &lt;Widget&gt;[
                      new Column(
                        children: &lt;Widget&gt;[
                          new Icon(
                            Icons.place,
                            size: 18.0,
                          ),
                          new Text('State',
                              style: new TextStyle(
                                  fontSize: 11.0, color: Colors.blue)),
                        ],
                      ),
                      new Padding(
                          padding: const EdgeInsets.only(right: 16.0)),
                      new Text(snapshot.data['state'], style: new TextStyle(fontSize: 25.0)),
                    ],
                  ),
                  new Padding(padding: const EdgeInsets.only(top: 3.0)),
                  new Divider(color: Colors.grey, height: 1.0),
                  new Padding(padding: const EdgeInsets.only(bottom: 25.0)),
                  new Row(
                    children: &lt;Widget&gt;[
                      new Column(
                        children: &lt;Widget&gt;[
                          new Icon(
                            Icons.audiotrack,
                            size: 18.0,
                          ),
                          new Text('Hobby',
                              style: new TextStyle( fontSize: 11.0, color: Colors.blue)),
                        ],
                      ),
                      new Padding(
                          padding: const EdgeInsets.only(right: 16.0)),
                      new Text(snapshot.data['hobby'], style: new TextStyle(fontSize: 26.0)),
                    ],
                  ),
                  new Padding(padding: const EdgeInsets.only(top: 3.0)),
                  new Divider(color: Colors.grey, height: 1.0),
                ],
              ),
              new SizedBox(height: 45.0),
              new RaisedButton(
                child: new Text('New Request',
                    style:
                        new TextStyle(color: Colors.white, fontSize: 20.0)),
                color: Colors.blueAccent,
                splashColor: Colors.blueGrey,
                onPressed: () {
                  _toNewRequest();
                },
              ),
            ],
          ),
        );
      } else {
          return new Center(
            child: new Text('You havent set profile'),
          );
        }
      },
    ),
  </code></pre>
  
  <p>but error says this</p>
  
  <blockquote>
    <p>flutter: The following NoSuchMethodError was thrown building
        StreamBuilder(dirty, state: flutter:
         _StreamBuilderBaseState>#f91a2) The method '[]' was
    called on null.  Receiver: null Tried calling:[]
    ("name")</p>
  </blockquote>
  
  <p>but if I refresh(restart maybe) the app, click the green arrow,</p>
  
  <p><a href="https://i.stack.imgur.com/5S45r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5S45r.png" alt="enter image description here"></a></p>
  
  <p>then it shows data correctly.
  why is this not working when app launches?
  Thank you in advance!</p>