Is streamBuilder Widget needs to be disposed?

Viewed 717

I already know if I want to use stream listen in method to a snapshot so i need to use StreamSubscription then dispose it using .cancel();

but what if use streamBuilder under build method to get data from fisrstore, do i need to dispose it too if yes HOW ?.. or it will be disposed it self when I press back bottom ?

  @override
  Widget build(BuildContext context) {

          
          return StreamBuilder(
            stream: FirebaseFirestore.instance.collection("users").doc(widget.userId).snapshots(),
            builder: (context, snapshot)  {
              if (!snapshot.hasData) {
                return circulearProgress();

              }
1 Answers
Related