StreamBuilder throws Dirty State saying Invalid Arguments StreamBuilder throws Dirty State saying Invalid Arguments dart dart

StreamBuilder throws Dirty State saying Invalid Arguments


The error is because you are trying to sum String + null in this line:

print("pritish" + snapshot.data);

So, to fix your issue use String interpolation:

print("pritish : ${snapshot.data}");

Don't forget to wrap your HomePage widget inside the provider.

 MaterialApp(        home: Provider(          child: HomePage()        ),      ),