At 1:04:56, no offense, but the explanation seemed a bit flaky. Here are my 2 cents on why the state is not changing even after adding a new to-do object in the 'state' list. When we first initiate the state with an empty list [], this list has an address in memory (say A1), similar to how a house has an address. Continuing with this analogy, like how if more people start residing in the house, the address of the house does not change, similarly if we add more elements in the list, the address of the list will also not change. The emit() function likely compares two states based on the r-value (which is address in the case of Lists, Maps, and objects, and the actual value in the case of primitives like int, float, double, etc). Here emit() concludes that the state has not changed, since the address of the list has not changed, therefore it stops any further processing. Therefore, to actually change the address of the list, 1. We have to create a copy of the list (This creates a new list with a new address (say A2)) 2. Add the items in this new list 3. Pass this new list to emit() Now when emit() compares the two lists, it finds that the address is different, and it updates the state. Hope this helped someone.
@@sagarshah5341 it's general programming concepts not dsa. It works based on the address of list, map etc. To understand this in details need to know how equals and hashcode works
Damn Good explanation Bro , But I didn't understood one thing , as per u r explanation - When we first initiate the state with an empty list [], this list has an address in memory (say A1) which does not contain any value. - Then if we add a value to that list the address of the list will still be the same - According to this analogy , why the first element that is being added is getting shown ? - If u observe clearly at 1:02:55 the first value is shown , its stopped showing only from 2nd value
As of now, This man is God Gift for flutter developer, His insane contribution for Flutter Developers always be memorable in flutter history, this much quality content absolutely for free is ❤❤❤❤❤.
This tutorial is a gem for Flutter developers. The explanations provided are incredibly detailed, making a complex pattern appear straightforward. I'm grateful for the thorough guidance provided by the instructor. Thank you, Master.❤
You're a genius! Unlike other TH-camrs who explain everything at the beginning, you saved the block definition explanation for the end of the video. I really appreciate your content, and thanks to your 2-hour 30-minute tutorial, I successfully cracked the interview. Thank you!
I have spent over 10 hours learning Bloc and this 2.5 hour have been the most valuable in my journey thank you for such a good explanation though I was unable to learned the weather app completely but I am hoping to cover it up soon by rewatching it.
Hey! Just wanted to say thanks! I was on the fence about whether to invest about 3 hours of my time in it, but I am glad I did. Your shown examples along with the explanations helped clear out a lot of the confusions and questions I had.
As my 7th-semester exams are concluding next week in pursuit of a CS degree, I'm eager to delve into Flutter projects. I already have a grasp of Flutter and Dart basics. However, time is limited, and with companies beginning recruitment, I'm feeling the pressure due to the absence of projects. I would greatly appreciate your guidance, Rivaan, including video recommendations to kickstart my Flutter journey, project ideas, and tips for both project development and placement preparation. Your assistance means a lot 🙏🏻
Thanks, it's really helpful because following the login tutorial from the bloc documentation wasn't enough for a beginner like me. You explain really well, thanks for your time
When I started watching, I thought "I won't sit here for 2.5 hours..." but I did. This is a great video which explains the subject matter very clearly with good examples.
I came to learn Bloc State Management and ended up as his fan. I love the way how he Explain and teach. If this course was on Udemy, he must hai Millions of Students by now. (An this course should be on Platforms like Udemy) 💯❣💫
At 1:47:38, to avoid the little error glitch is it a good idea to add a check if state is AuthInitial in the BlocBuilder part of the BlocConsumer and return an empty widget like Center? Ex: if (state is AuthLoading) { return const Center( child: CircularProgressIndicator(), ); } if (state is AuthInitial) { return const Center(); } //AuthSuccess Part
On 25:09 would it be a better idea to create a global object for the class CounterCubit? That way we only have to deal with the global instance of the state! What do you think? class CounterCubit extends Cubit { // int counter = 0; CounterCubit() : super(0); void incr() { emit(state + 1); } void decr() { if (state == 0) { return; } emit(state - 1); } } // after creating this object in the same file, no NEED for an extra PROVIDER at all final gCounterCubitObj = CounterCubit();
Is not a glich, the state changes really fast and create that effect, add this code below the CircularProgressImdicator if: If(state is AuthSuccess){ return const SizedBox(); } Problem solved
I am getting an error at 12:00 when we add incrememt method to the onpressed button and the error says Error: The method 'increment' isn't defined for the class 'int'. Try correcting the name to the name of an existing method, or defining a method named 'increment'. onPressed:() => counterCubit.increment(),
this is so awesome bloc tutorial and very clear so that developers like me can understand. Can you make a video about the features first appraoch or some project based on bloc
Am I the only one with an error when a try to logout after the modification at 1:47:20 A receive type AuthInitial is not a subtype of type Authsuccess in type cast. I tought maybe I made a mistake and run the end project from Rivaan github and have the exact same error
Hey Rivaan I have a doubt in Todo app , when we first update the empty list by state.add() then emit(state) then why emit is notifying the listeners about the change? I mean todo list page should not show anything right?
Best Video of bloc no doubt just one thing could you explain more about equatable using bloc and why we do it and what error we can face if we dont if you cannot make a video just reply with some answer because i have noticed sometimes we do the same emit twice bloc listener get called once so will equatable do some logic
Thank you for this! But after finishing this, the weather app didn’t work anymore. The circular progress indicator was just circling infinitely. I tried to run your finished weather app folder on GitHub to check if I didn’t make some kind of error while following the video, but I still got an error, this time "type 'int' is not a subtype of type ‘double' in type cast"
Thank you so much for tutorial sir.. but getting one error in weather app after all functionality done. "int is not subtype of double" this error also occurred in your weather app that i got from your github and run it then same error got
Error Solution at 1:47:07 Type of Error Exception has occurred. _TypeError (type 'AuthInitial' is not a subtype of type 'AuthSucess' in type cast) Solution To fix this issue, you should handle each state appropriately in both the listener and the builder. Here's how you can modify your code to handle the AuthInitial state in both places Code class HomeScreen extends StatelessWidget { const HomeScreen({super.key}); @override Widget build(BuildContext context) { return BlocConsumer( listener: (context, state) { if (state is AuthInitial) { // Navigate to the login screen if authentication process is not started Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute(builder: (context) => LoginScreen()), (route) => false); } }, builder: (context, state) { if (state is AuthLoading) { return const CircularProgressIndicator.adaptive(); } else if (state is AuthSuccess) { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Center( child: Text(state.name), ), GradientButton(onPressed: () { context.read().add(AuthLogOut()); }), ], ); } else { // Handle other states here (e.g., AuthFailure) return Container(); // Placeholder for now } }, ); } } Thank you
Hey Rivaan, Kindly make a video on Flutter using Stacked state management, tutorials on stacked are almost impossible to find, would be of great helpp!
At 1:04:56, no offense, but the explanation seemed a bit flaky. Here are my 2 cents on why the state is not changing even after adding a new to-do object in the 'state' list.
When we first initiate the state with an empty list [], this list has an address in memory (say A1), similar to how a house has an address.
Continuing with this analogy, like how if more people start residing in the house, the address of the house does not change, similarly if we add more elements in the list, the address of the list will also not change.
The emit() function likely compares two states based on the r-value (which is address in the case of Lists, Maps, and objects, and the actual value in the case of primitives like int, float, double, etc).
Here emit() concludes that the state has not changed, since the address of the list has not changed, therefore it stops any further processing.
Therefore, to actually change the address of the list,
1. We have to create a copy of the list (This creates a new list with a new address (say A2))
2. Add the items in this new list
3. Pass this new list to emit()
Now when emit() compares the two lists, it finds that the address is different, and it updates the state. Hope this helped someone.
Good explanation, thanks for taking the time to write & help others!
Man you are good at DSA!
@@sagarshah5341 it's general programming concepts not dsa. It works based on the address of list, map etc. To understand this in details need to know how equals and hashcode works
@@jatindersinghaujla The guy understood what I was implying.
Damn Good explanation Bro , But I didn't understood one thing , as per u r explanation
- When we first initiate the state with an empty list [], this list has an address in memory (say A1) which does not contain any value.
- Then if we add a value to that list the address of the list will still be the same
- According to this analogy , why the first element that is being added is getting shown ?
- If u observe clearly at 1:02:55 the first value is shown , its stopped showing only from 2nd value
As of now, This man is God Gift for flutter developer, His insane contribution for Flutter Developers always be memorable in flutter history, this much quality content absolutely for free is ❤❤❤❤❤.
Thank you so much!!
It is hard working not a gift.
This tutorial is a gem for Flutter developers. The explanations provided are incredibly detailed, making a complex pattern appear straightforward. I'm grateful for the thorough guidance provided by the instructor. Thank you, Master.❤
Seen a lot of state management tutorials but this one is on Top.
Wow, I've been after some good, well explained bloc tutorials for a while and yours got literally all my questions answered. thank you so much!
You're a genius! Unlike other TH-camrs who explain everything at the beginning, you saved the block definition explanation for the end of the video. I really appreciate your content, and thanks to your 2-hour 30-minute tutorial, I successfully cracked the interview. Thank you!
That's great news, congratulations Akshay 🥳
I have spent over 10 hours learning Bloc and this 2.5 hour have been the most valuable in my journey thank you for such a good explanation though I was unable to learned the weather app completely but I am hoping to cover it up soon by rewatching it.
You are the best thing ever happened to flutter. Your explanations are beginner friendly. Thanks
Thank you!
Manhhhh! This is the best tutorial out in TH-cam for bloc state management
You are amazing
Hey! Just wanted to say thanks! I was on the fence about whether to invest about 3 hours of my time in it, but I am glad I did. Your shown examples along with the explanations helped clear out a lot of the confusions and questions I had.
As my 7th-semester exams are concluding next week in pursuit of a CS degree, I'm eager to delve into Flutter projects.
I already have a grasp of Flutter and Dart basics. However, time is limited, and with companies beginning recruitment, I'm feeling the pressure due to the absence of projects.
I would greatly appreciate your guidance, Rivaan, including video recommendations to kickstart my Flutter journey, project ideas, and tips for both project development and placement preparation.
Your assistance means a lot 🙏🏻
For those who don't know, Rivaan is only 17
Ikrrrr💀🗿💥
Hats off
A big round of applause ✋
A big thanks for this 🙏
My pleasure!
Thanks, it's really helpful because following the login tutorial from the bloc documentation wasn't enough for a beginner like me. You explain really well, thanks for your time
I was wondering when Rivaan will move to bloc and here it is. Thank you for showing me a lot in flutter.
My pleasure!
Very valuable content. No one has taught like this❤
When I started watching, I thought "I won't sit here for 2.5 hours..." but I did. This is a great video which explains the subject matter very clearly with good examples.
Thanks so much. This course was a long overdue for me but I finally got it done. I feel way more confident about Bloc and Cubit now.
I came to learn Bloc State Management and ended up as his fan. I love the way how he Explain and teach. If this course was on Udemy, he must hai Millions of Students by now. (An this course should be on Platforms like Udemy) 💯❣💫
For first time I saw a tutorial completely. 🙂
I have no words!! Fluent like air!!!! Thanks !!!!
Thank you!
This video is worth watching. You cleared so many doubts.
a big project with bloc and supabase would be very awesome & unique.
OH MY GOD!!! THANK YOU SO MUCH SIR... this is by far the best video for bloc tutorial.
Nice Video! Thanks from Azerbaijan!
At 1:47:38, to avoid the little error glitch is it a good idea to add a check if state is AuthInitial in the BlocBuilder part of the BlocConsumer and return an empty widget like Center? Ex: if (state is AuthLoading) {
return const Center(
child: CircularProgressIndicator(),
);
}
if (state is AuthInitial) {
return const Center();
}
//AuthSuccess Part
Thank you so much for putting huge amount of time and effort!
Thanks! I just finished and finally understand!
You are just awesome my friend. I watch your videos on priority. It helps me stay polished.
finally, the Most awaited video ✅ best flutter channel exists on YT
Thank you!!
was despereatly waiting for bloc wanna see fullstack project on bloc & cubit
On 25:09 would it be a better idea to create a global object for the class CounterCubit?
That way we only have to deal with the global instance of the state!
What do you think?
class CounterCubit extends Cubit {
// int counter = 0;
CounterCubit() : super(0);
void incr() {
emit(state + 1);
}
void decr() {
if (state == 0) {
return;
}
emit(state - 1);
}
}
// after creating this object in the same file, no NEED for an extra PROVIDER at all
final gCounterCubitObj = CounterCubit();
Riwan love you man the way you explained bloc outstanding brother, Crystal-clear explanation superb 👏
Such a great teacher !
Thank you!
i did not know bloc was so easy .thank you so much rivan bhai
Dear Rivaan , U have an excellent explanation skills bro ❤🔥 , This one is a gem 😍
1:37:17 when after circular loading indicator ends it shows previous screen for a bit and then goes to next one, is it a glitch or what?
Is not a glich, the state changes really fast and create that effect, add this code below the CircularProgressImdicator if:
If(state is AuthSuccess){
return const SizedBox();
}
Problem solved
Thanks!
Thank you!
Your way of explaining bloc pattern is amazing.
Please make a video of about MVVM architecture using provide.
thanks
I am getting an error at 12:00 when we add incrememt method to the onpressed button and the error says
Error: The method 'increment' isn't defined for the class 'int'.
Try correcting the name to the name of an existing method, or defining a method named 'increment'.
onPressed:() => counterCubit.increment(),
Can you share how you created the variable counterCubit?
this is so awesome bloc tutorial and very clear so that developers like me can understand. Can you make a video about the features first appraoch or some project based on bloc
Will be coming soon, hopefully March!
Thankyou so much maaan . Really helpful ❤ . God bless
MashaAllah.. very good explanation. Deep like diving in the ocean. Recommended to watch.
Thank you!
You are the best tutor ever!
Thank you!!
Hats off waiting for this 🔥
Hope it was helpful!
awesome sir. you are the mentor who i was looking for🎉.please,upload more.
best tutorial i heard in a long time🤩
Thanks!
A Very Big Thanks to You Sir ❤❤
Rivaan you are gem for a flutter community.
Thanks for clearing my doubts.!!!
Glad it was helpful:)
Am I the only one with an error when a try to logout after the modification at 1:47:20
A receive type AuthInitial is not a subtype of type Authsuccess in type cast.
I tought maybe I made a mistake and run the end project from Rivaan github and have the exact same error
Just saw that he have the same mistake in a frame of the video...
@@alexandreforget7866 Did you fix it??
Man you rock! Thanks a lot for sharing your expertise ❤
finished!! Amazing content ❤❤❤
Thank you!
Thank you so much sir for uploading a new flutter video again . How long have we been waiting for your next Flutter video?
brilliant! thank you kind sir! very nice method of teaching!
Hey Rivaan I have a doubt in Todo app , when we first update the empty list by state.add() then emit(state) then why emit is notifying the listeners about the change? I mean todo list page should not show anything right?
He is a better teacher than a coder😂
best teacher ever!
You are awesome at making complex things easy ❤
Thank you!
Nicely done.
Hello! I have an issue with the Weather App. It gets me error message -~type 'int' is not a subtype of type 'double' ~-
Outstanding Explanation.....
Thank you!!
thanks a lot Rivaan
Such a great Tutorial.
Thanks, glad you liked it!
Thank you for the wonderful tutorial bro, it is very helpful for me and my team thanks again
My pleasure!
oh yrr Rivan i dont know who told you what we need on which time 🤣🤣.... tnku Gem
Hahaha, thank you!
An Advantageous tutorial.👋
Glad you think so!
I was waiting for this only 🔥🔥
Hope it helps!
Best Video of bloc no doubt just one thing could you explain more about equatable using bloc and why we do it and what error we can face if we dont if you cannot make a video just reply with some answer because i have noticed sometimes we do the same emit twice bloc listener get called once so will equatable do some logic
how you are getting logs .please tell me if there is any extension ,as my console is getting filled with unnecessary data but not like your console
I'm running it on an iPhone Simulator
bloc VS riverpod, which one better for large scale application? please tell me and why?. thank you
Amazing video, that's very good
Thank you!
your video is very useful!
So, i have one Question, Is there any no need domain layer that use in clean architecture?
Good Bro I wish luck your works
Great video 👌👌👌
it was fantastic!!! thanks
Glad you liked it!
Tqsm bro for making videos most beautiful 😍
Most welcome!
You are insane. Thx for everything. Im learning from u a lot.
so which is more recommended Bloc or Riverpod ?
Thank you for this! But after finishing this, the weather app didn’t work anymore. The circular progress indicator was just circling infinitely. I tried to run your finished weather app folder on GitHub to check if I didn’t make some kind of error while following the video, but I still got an error, this time "type 'int' is not a subtype of type ‘double' in type cast"
this is pure gold
That's amazing, good video
May you do a video with flutter and gemini pro api please
How to handle stream and bloc state value in another bloc
which plugin are you using for icon theme ?
???
is vscode icon 😂
vscode-icons
Thanks@@RivaanRanawat
Please do a video on Stacked MVVM Architecture
Pls make a dedicated course on fl_charts and also make a video on how to use fl_charts with api to use real time data for the graphs
Thank you so much for tutorial sir.. but getting one error in weather app after all functionality done. "int is not subtype of double"
this error also occurred in your weather app that i got from your github and run it then same error got
You are the best 😘😘
Thank you!
Awesome thanks bro
Error Solution at 1:47:07
Type of Error Exception has occurred.
_TypeError (type 'AuthInitial' is not a subtype of type 'AuthSucess' in type cast)
Solution
To fix this issue, you should handle each state appropriately in both the listener and the builder. Here's how you can modify your code to handle the AuthInitial state in both places
Code
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return BlocConsumer(
listener: (context, state) {
if (state is AuthInitial) {
// Navigate to the login screen if authentication process is not started
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => LoginScreen()),
(route) => false);
}
},
builder: (context, state) {
if (state is AuthLoading) {
return const CircularProgressIndicator.adaptive();
} else if (state is AuthSuccess) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(state.name),
),
GradientButton(onPressed: () {
context.read().add(AuthLogOut());
}),
],
);
} else {
// Handle other states here (e.g., AuthFailure)
return Container(); // Placeholder for now
}
},
);
}
}
Thank you
Quite good explain
what do you feel which is better bloc or riverpod for state management tool
?
try both and see which one rocks your boat
Hey Rivaan, great tutorials brother. Can you also make a tutorial for Provider like you did for Bloc?
He had it.. you can see it ( in his 3rd app in 20h course of flutter for beginners) but there nothing much in providers ❤
which file icon theam your are useing
23:40 🤣 you're the goat
Hey Rivaan, Kindly make a video on Flutter using Stacked state management, tutorials on stacked are almost impossible to find, would be of great helpp!
Which theme are you using? Could you please tell me the name ???
.
write this in search and we found the theme 'eserozvataf.one-dark-pro-monokai-darker' the name is One Dark Pro Monokai Darker theme
great boss...................
Thanks!
Great one
Thanks Joel!
well explained
how to grant permission to open user system settings??