title: How to call Stream Builder after pressing a material button?
body: <p><strong>Context</strong>: I am facing an issue that for some reason when I click on the button the logic inside the Stream Builder is not being called. He makes the api call to authenticate the user and enters the <code>stream: userBloc.authenticationUserStream</code> but not the <code>builder</code></p>
  
  <p><strong>What have I tried :</strong> Tried to see if there was some kind of return issue on the UserBloc class, but I think everything is correct. I have some other widget that does not involve clicking buttons (I can the api from the constructor) and it works fine so I think the problem can be on the clicking state.</p>
  
  <p>This is my code from the UI:</p>
  
  <pre><code> class _LoginScreenState extends State&lt;LoginScreen&gt; {
  
           @override
        void initState() {
          super.initState();
          userBloc = UserBloc();
        }
      }
  
   final loginButton = Material(
        elevation: 5.0,
        borderRadius: BorderRadius.circular(30.0),
        color: Color(0xff01A0C7),
        child: MaterialButton(
          minWidth: MediaQuery.of(context).size.width,
          padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
          onPressed: () {
            userBloc.authenticateUser(emailController.text.toString(),
                passwordController.text.toString());
            StreamBuilder&lt;ApiResponse&lt;LoginResponse&gt;&gt;( // does not enter here
                stream: userBloc.authenticationUserStream,
                builder: (context, snapshot) {
                  if (snapshot.hasData) {
                    switch (snapshot.data.status) {
                      case Status.LOADING:
                        return Loading(
                          loadingMessage: snapshot.data.message,
                        );
                        break;
                      case Status.COMPLETED:
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) =&gt; MovieScreen()),
                        );
                        break;
                      case Status.ERROR:
                        Scaffold.of(context).showSnackBar(SnackBar(
                          content: Text("Error"),
                        ));
                        break;
                    }
                  }
                  return Container();
                });
          },
          child: Text("Login", textAlign: TextAlign.center),
        ),
      );
  </code></pre>
  
  <p>This is my code for the <code>UserBloc</code></p>
  
  <pre><code>class UserBloc {
    UserRepository userRepository;
    StreamController streamController;
  
    StreamSink&lt;ApiResponse&lt;LoginResponse&gt;&gt; get authenticationUserSink =&gt;
        streamController.sink;
  
    Stream&lt;ApiResponse&lt;LoginResponse&gt;&gt; get authenticationUserStream =&gt;
        streamController.stream;
  
    UserBloc() {
      streamController = StreamController&lt;ApiResponse&lt;LoginResponse&gt;&gt;();
      userRepository = UserRepository();
    }
  
    authenticateUser(String email, String password) async {
      authenticationUserSink.add(ApiResponse.loading("Logging"));
      try {
        // success
        LoginResponse loginResponse =
            await userRepository.authenticateUser(email, password);
        authenticationUserSink.add(ApiResponse.completed(loginResponse));
      } catch (e) {
        // error
        authenticationUserSink.add(ApiResponse.error(e.toString()));
      }
    }
  
    dispose() {
      streamController?.close();
    }
  }
  </code></pre>
  
  <p>Can someone give me a help understanding how to call this kind of stuff after pressing a button. I can share my <code>user repository</code> code if necessary, thanks in advance for the help.</p>