title: The following NoSuchMethodError was thrown building StreamBuilder<UserData>(dirty, state: _StreamBuilderBaseState<UserData, AsyncSnapshot<UserData>>):
body: <p>I am trying to build a user settings menu for an app with firebase through the Flutter framework but whenever I try to open my settings form it tells me that the name property that I previously assigned to 'name' is now set to null.</p>
  <pre><code>class SettingsFormTwo extends StatefulWidget {
    @override
    _SettingsFormState createState() =&gt; _SettingsFormState();
  }
  
  class _SettingsFormState extends State&lt;SettingsFormTwo&gt; {
  
    final _formKey = GlobalKey&lt;FormState&gt;();
    final List&lt;String&gt; sugars = ['0', '1', '2', '3', '4'];
    final List&lt;int&gt; strengths = [100, 200, 300, 400, 500, 600, 700, 800, 900];
  
    // form values
    String _currentName;
    String _currentSugars;
    int _currentStrength;
  
    @override
    Widget build(BuildContext context) {
  
      Player player = Provider.of&lt;Player&gt;(context);
  
      return StreamBuilder&lt;UserData&gt;(
          stream: DatabaseService(uid: player.uid).userData,
          builder: (context, snapshot) {
              UserData userData = snapshot.data;
              return Form(
                key: _formKey,
                child: Column(
                  children: &lt;Widget&gt;[
                    const Text(
                      'Update your brew settings.',
                      style: TextStyle(fontSize: 18.0),
                    ),
                    SizedBox(height: 20.0),
                    TextFormField(
                      initialValue: userData.name, // This is where it says the error is at
                      decoration: textDecoration,
                      validator: (val) =&gt; val.isEmpty ? 'Please enter a name' : null,
                      onChanged: (val) =&gt; setState(() =&gt; _currentName = val),
                    ),
                  ],
                ),
              );
            }
      );
    }
  }
  </code></pre>
  <p>Here is a snippet of the error message that I got.</p>
  <pre><code>The following NoSuchMethodError was thrown building StreamBuilder&lt;UserData&gt;(dirty, state: _StreamBuilderBaseState&lt;UserData, AsyncSnapshot&lt;UserData&gt;&gt;#169ee):
  The getter 'name' was called on null.
  Receiver: null
  Tried calling: name
  </code></pre>