title: Flutter keyboard disappears when streambuilder rebuilds
body: <p>I have a textformfield inside a streambuilder, since I need to show it only if Firestore documents match some criterias.</p>
  <p>The problem is that when there is new data in the database, the streambuilder rebuilds (and that's fine) and if I had the virtual keyboard open, it closes.</p>
  <p>Is there any way to prevent the keyboard from closing?</p>
  <p>edit: I add some code</p>
  <pre><code>     StreamBuilder(
            stream: FirebaseFirestore.instance.collection('bets').snapshots(),
            builder: (context, AsyncSnapshot msgSnapshot) {
              if (msgSnapshot.hasError) {
                return Text('Error');
              }
  
              if (msgSnapshot.connectionState == ConnectionState.waiting) {
                return Padding(
                  padding: const EdgeInsets.all(20.0),
                  child: Center(child: CircularProgressIndicator()),
                );
              }
  
              if (msgSnapshot.hasData) {
                
  
                _focusNode.requestFocus();                  
  
                return Container( ....
  </code></pre>
  <p>this is the streambuilder code, so the requestfocus should fire at each new data arrival. But it doesn't.</p>
  <p>This is the textformfield:</p>
  <pre><code>Container(
            width: 200,
            child: TextFormField(
              //autofocus: true,
              focusNode: _focusNode,
              controller: myController,
              keyboardType: TextInputType.number,
              decoration: InputDecoration(
                hintText: 'Inserisci',
                hintStyle: TextStyle(
                  fontSize: 14,
                  color: Colors.grey.shade800,
                ),
              ),
            ),
          ),
  </code></pre>
  <p>The only workaround (sort of) I found is setting autofocus to true, but that's not a real option because anyway the keyboard disappears for a second before popping up again, so it's not ideal in case of the user is typing.</p>
  <p>why the set focus doesn't work inside of my streambuilder?</p>