You would not normally use StatefulWidget+setState with BLoC. Rather, you would take the output stream from a BLoC and feed it to a StreamBuilder, which rebuilds your UI.
@@CodeWithAndrea Ok thanks. Actually my real issue is that I am loading a lot of network images in a widget (around 100), so if I load them through stream builder (say by providing the image url), will it make the network call again when the widget is being rebuilt (like during push, pop navigation)?
how to avoid unnecessary rebuilds? example: Widget A. Widget B. Widget C. Here when I update a state in Widget A with provider, the Widgets B and C rebuilds too. So how to avoid unnecessary rebuilds in B and C ?
Depends in your use case. I often use Provider+ChangeNotifier for local state that needs to be shared across widgets, and Provider+Bloc when working with streaming APIs (e.g. Firebase).
Hi Andrea, I have a problem with the Stream builder authentication with firebase. I followed your tutorial "Flutter & Firebase authentication with streams and StreamBuilder", everything works fine, except the HomeScreen is not returned visible when I log in on a different page than the SignInPage (I pushed a new route to a SignUpPage). The reason is (as far as I understand) that HomeScreen and SignInPage are only switched below, invisible, under the SignInPage. What is the best solution to fix this? Thanks in advance!
Hi Marty. You are correct, this is what happens when you push a new route. The best way to address this is to add a call to Navigator.pop() right after the sign in call succeeds. That way the page is dismissed and you are taken to the HomePage.
Emyboy Beats It depends. For local application state, I recommend Value/ChangeNotifier + Provider. If you have a real-time backend, or stream-based APIs, then BLoCs work well. And StatefulWidgets + setState when working with text input & forms.
This is a very good tutorial. I have a question. How can I use pageview or tabbarview in a stateless widget?
On the subject of ValueNotifier, in what scenario would you use ValueListenableBuilder over ChangeNotifierProvider?
When you don't want to use provider package.
@@CuiqkOfficial Could you give an example of when you wouldn't want to use provider?
@Andrea whenever we call 'setState()' the complete widget and its children are built, is this the same case in BLoC and provider implementation?
You would not normally use StatefulWidget+setState with BLoC. Rather, you would take the output stream from a BLoC and feed it to a StreamBuilder, which rebuilds your UI.
@@CodeWithAndrea Ok thanks. Actually my real issue is that I am loading a lot of network images in a widget (around 100), so if I load them through stream builder (say by providing the image url), will it make the network call again when the widget is being rebuilt (like during push, pop navigation)?
hi bro
flutter full course?
how to avoid unnecessary rebuilds? example:
Widget A.
Widget B.
Widget C.
Here when I update a state in Widget A with provider, the Widgets B and C rebuilds too.
So how to avoid unnecessary rebuilds in B and C ?
Keep an eye of my upcoming videos on Provider. I cover this issue there.
So which one is a good choice to go with?
Depends in your use case. I often use Provider+ChangeNotifier for local state that needs to be shared across widgets, and Provider+Bloc when working with streaming APIs (e.g. Firebase).
@@CodeWithAndrea Can we achieve the size of flutter apps just like native android or ios app sizes?
Hi Andrea, I have a problem with the Stream builder authentication with firebase. I followed your tutorial "Flutter & Firebase authentication with streams and StreamBuilder", everything works fine, except the HomeScreen is not returned visible when I log in on a different page than the SignInPage (I pushed a new route to a SignUpPage). The reason is (as far as I understand) that HomeScreen and SignInPage are only switched below, invisible, under the SignInPage. What is the best solution to fix this?
Thanks in advance!
Hi Marty. You are correct, this is what happens when you push a new route. The best way to address this is to add a call to Navigator.pop() right after the sign in call succeeds. That way the page is dismissed and you are taken to the HomePage.
Thanks Andrea for making such highly informative videos on flutter.
Thanks Andrea for distilling 2 years of effort
Hello Andrea, do you do freelance work?
which is better for scaleable apps setState, BLoC, ValueNotifier, Provider?
Emyboy Beats It depends. For local application state, I recommend Value/ChangeNotifier + Provider. If you have a real-time backend, or stream-based APIs, then BLoCs work well. And StatefulWidgets + setState when working with text input & forms.
@@CodeWithAndrea Okay thank you.