Hello, everyone! The entire course is now live on Udemy too, get it while it's hot --> www.udemy.com/course/bloc-from-zero-to-hero/?referralCode=E689592633984B34DBEF Also I have just managed to finally finish the entire BLoC - From Zero to Hero Complete Course, based on this tutorial series. You can check it out here -> ua-cam.com/video/THCkkQ-V1-8/v-deo.html
WCKD is a lifesaver 😍. I was so frustrated with the State Not Updating thing and Now I know the correct way to do it. I am glad I had notifications turned on 🙌.
This video is a lifesaver i was mutating the state the whole time and asking my self why the UI not working Thanks man for saving me you desurve my like and subscribe ❤
Thank you for these great tutorials. I spent so much time to understand and deal with unexpected output/errors, finally, thises video cleared ally my misconception of the flutter_blok package. keep it up.
By far one of the most useful tutorial series I've every watched for flutter! 💙 Please keep up this great work at this excellent quality. I've "binge watching" this tonight, could not stop at all 😉 Personally I'm using BLoC now for more or less one year, also productive, but still, there are so many helpful informations in your tutorials. Some interesting topics for me (and I can imagine also for other people) would be: * Explain why the class in a bloc state is "abstract" and whats the difference between abstract and non abstract? * Is it okay to use context.watch() really often in one page? like 20 - 30 times? Or does this impact the performance of an app? * Should I now generally prefer using context.watch over a BlocBuilder? I can't wait to get to the next tutorial, and maybe soon to the Bloc tutorials with Event Streams. Thanks a lot for sharing your knowledge!
Wow, such an amazing feedback! Thank you so much, mate! I really appreciate it! I can quickly answer to some of your questions, since they don't really need an entire video. So, let me begin, haha. 1. Abstract class is, like is name is implying, something abstract. It's not really "detailed", it's something blurry. It's like a global type of class, from which other small classes derive. In your case, you saw in this tutorial that when we have only one Settings State there's no need to create an abstract class, but when we'll have multiple possible states, it's a good practice to create a WeatherBloc with an abstract WeatherState just so the multitude of states will be "small part" of the global WeatherState. You can find more information about this by searching Google for Dart abstract classes.
2 and 3 - Context.watch() is just an addition to BlocBuilder. I'm not a big fan of these new methods, I'd still use Bloc Builder everywhere. In a big application I don't think you would have to use Bloc Builder more than let's say 5-10 times inside a page. If that number exceedes, you should think about partitioning the page into multiple small pieces, since having a ton of code inside a single page will drastically decrease your efficiency.
@@Flutterly Could you make full example about what you explained not just a tips of code I mean example that contains crud operations dealing with server It's not an example It's a small project 😅
I don't get it why this one has only 500 like xD, in mycase if I didn't watch this video, I swear I was 100% going to modify the state directly coming from js background
keeeeeep posting pleasseee !!!! OMG you're a lifesaver ! and also if you can start building an e-commerce app from scratch ,it would be very useful . thanks man !
Hey thanks for your wonderful tutorial, but I have got a question. Should we use equatable along with copyWith function for comparing our states? I am not sure why Equatable is neccessary here if Dart compares the instance by object instead of values by default. Whenver we create a new state instance by copyWith function, wouldn't Dart be able to compare already? It seems like it works as charm even if you didn't extend equatable from the tutorials above. Thank you
Man, as I stated inside the tutorial, copyWith and Equatable are 2 completely different things. If you want to compare two instances by value, you should extend Equatable or override the equal operator (==) as you wish. The copyWith method has nothing to do with comparing stuff. It is mainly used for creating a new instance from an already existing one, by mentioning the parameters that are changed in the new one compared to the old one (see the code in the tutorial).
Concise and clear 💙 Could you make a video on InheritedWidgets? Or how does Provider.of() cause a widget deep down the tree to be rebuilt while keeping its parents intact?
So much easier to understand when there are pictures 😁 Really enjoyed it! Just one question => Must we use both copyWith and Equatable props together, or is only Equatable enough?
Thanks. It's either one or another, never both. Basically, Equatable is a simple version of copyWith() and hash() all together. I suggest that you only use Equatable. Thanks!
@@Flutterly why never both ? in some Felix Angelov projects he used Equatable and copywith at the same time ! take a look here : github.com/felangel/bloc/blob/master/examples/flutter_firebase_login/lib/login/cubit/login_state.dart
Sorry, I meant saying that you should use either Equatable or the override of the equality operator, never both (which makes sense) . My mistake, I'm sorry. I must've been tired when I replied. Sorry again. And yes, you can use copyWith with Equatable as they have nothing in common. They both have different purposes.
Some interesting topic for me : - Bloc Observer - Bloc Testing - Injectible - The initial Flow of an app, using bloc to Navigate between Onboarding, Login, Home
Great tutorial, I understood all of your videos, I have one doubt Didn't we were sending same state in previous counter examples then how we were getting new state we didn't use copywith method in counterState, how it was working fine?
Hi Flutterly, Am facing issue with state update using bloc pattern. I have followed all the possibilities as you mentioned in the video like extending equatable and declaring all the properties in the state. but still am facing the same issue. Could you please help me out on this some how if possible.
i do want to emit 2 states tho example. i delete with 1 button 2 objects, for each deleted object i want to show a bottom sheet for the user to review the object, so i emit 2 objects so 2 bottom sheets show up. unfortunately the second emition closes the first bottom sheet.
I have a doubt.. all these states have only one or two variables and passed inside constructor from cubit. Consider if a state contains 10 variable and those 10 are not updated and used at same time. At each scenario a single state variable is updated. How can we do that?
If you'd have a class A with var a, b, c, d, e, f initilaised in the constructor, then you would have a copyWith method as I did in this tutorial from where you can class classObject.copyWit(only mention the parameters you want to update here)
hey thank you for make this videos but i have question i have case that i need change frequently list in my app but when i emitting the state of my list i need to move the value to the new list because list is mutable i try to not put my list inside props but like in your video i need to put all my field inside list porps is there a way that i can still emitting my list without move to new list but still extends equatable ?
Thank you. I saw some examples using equatable but no one explained. I don't understand why use : super. I read something about initialize constructor, if compare with typescript or python or java this kind of constructor exist or it's just dart?
hey, @Flutterly is there anything wrong with changing appNotification/emailNotification bool variables with code like: emit(state.copyWith(emailNotification: !state.emailNotification)); discarding newValue altogether and making toggleNotification methods parameterless?
How you get those Generate generate things? when you press command + . because I cant get those Generate things.. all I get is Wrap wih BlocBuilder, BlocSelector etc.. etc... no wrap with.... :(
Perfect. And here I was thinking I'm the crazy one in my team to think mutating an object isn't the way to modify the sate. I do have a question though. If you have a list of objects that could be re arranged and you want the state of all the objects and its values maintained throughout the app, what would be the correct way of doing so? I use GetX and I'm trying to incorporate good architecture with it. I used stream subscriptions in the sub controllers(blocs) to update when the values in the parent bloc changes. Problem is, that if the list is re ordered, the listener of that list is updated, but the listeners of the individual objects are not triggered since they are entirely new instances which were never subscribed to. What would be the correct way to approach this?
Great vid WCKD, your lessons are always great. I have a question for you. I did some experiments with the Equatable package, listing the props with the this.* form. The app seemed to work fine although I'm not sure quite why. I am guessing that since Equatable is used to compare Objects, then parameters contained in the instance works the same. I dunno for sure though... Do you have some clues?
Also you said "Copy the content from the previous one to the new state" so you mean if the "previous state is ONE"..... then.... "copy that prevoius state ONE to the new state" so now "the new state is ONE" ? I dont get it .. I would appreciate and understand if you give example of prev state and the new state :)
One thing he didnt fully explain is why A cannot be equal to B. Even if they are both instances of myclass. The reason is they are not the SAME instance. If class is a blueprint then A and B were created with the same blueprint but they are not the same instance.
Hello, everyone!
The entire course is now live on Udemy too, get it while it's hot --> www.udemy.com/course/bloc-from-zero-to-hero/?referralCode=E689592633984B34DBEF
Also I have just managed to finally finish the entire BLoC - From Zero to Hero Complete Course, based on this tutorial series. You can check it out here -> ua-cam.com/video/THCkkQ-V1-8/v-deo.html
till 2024, there is no best tutorial elaborates bloc concepts clearly as this tutorial. Keep up going!
WCKD is a lifesaver 😍. I was so frustrated with the State Not Updating thing and Now I know the correct way to do it. I am glad I had notifications turned on 🙌.
Haha, thanks! 🌟 Glad I could help you understand more!
This video is a lifesaver i was mutating the state the whole time and asking my self why the UI not working
Thanks man for saving me you desurve my like and subscribe ❤
you content so underrated. so i decide to write comment with nice length to support you. keep going u do a great work for all flutter community!
Thank you so much 😀
These are by far the most informative Flutter state management tutorials, looking forward to more content from you.
Thank you so much, man! Really appreciate it!
Duddeeeeeeeee 🔥🔥🔥🔥🔥🔥🔥 I am so much grateful to you. ❤️ Much much love from India. You are a life saver.
Thank you so much, mate, really appreciated!
Thank you for these great tutorials. I spent so much time to understand and deal with unexpected output/errors, finally, thises video cleared ally my misconception of the flutter_blok package. keep it up.
By far one of the most useful tutorial series I've every watched for flutter! 💙 Please keep up this great work at this excellent quality. I've "binge watching" this tonight, could not stop at all 😉
Personally I'm using BLoC now for more or less one year, also productive, but still, there are so many helpful informations in your tutorials.
Some interesting topics for me (and I can imagine also for other people) would be:
* Explain why the class in a bloc state is "abstract" and whats the difference between abstract and non abstract?
* Is it okay to use context.watch() really often in one page? like 20 - 30 times? Or does this impact the performance of an app?
* Should I now generally prefer using context.watch over a BlocBuilder?
I can't wait to get to the next tutorial, and maybe soon to the Bloc tutorials with Event Streams.
Thanks a lot for sharing your knowledge!
Wow, such an amazing feedback! Thank you so much, mate! I really appreciate it! I can quickly answer to some of your questions, since they don't really need an entire video. So, let me begin, haha.
1. Abstract class is, like is name is implying, something abstract. It's not really "detailed", it's something blurry. It's like a global type of class, from which other small classes derive. In your case, you saw in this tutorial that when we have only one Settings State there's no need to create an abstract class, but when we'll have multiple possible states, it's a good practice to create a WeatherBloc with an abstract WeatherState just so the multitude of states will be "small part" of the global WeatherState. You can find more information about this by searching Google for Dart abstract classes.
2 and 3 - Context.watch() is just an addition to BlocBuilder. I'm not a big fan of these new methods, I'd still use Bloc Builder everywhere. In a big application I don't think you would have to use Bloc Builder more than let's say 5-10 times inside a page. If that number exceedes, you should think about partitioning the page into multiple small pieces, since having a ton of code inside a single page will drastically decrease your efficiency.
@@Flutterly Thank you sir 🤗
You are the besttttt. I wish I could give you Giulia Quadrifoglio :D
Haha, thank you so much! ✨
Thanks a lot sir, for educating us with your valuable content, even now {after 3 years}, It was a treasure for us
Wckd is back 💥🔥🔥
Hell yeah! 🔥
Thanks for your explanation quality 👌
Your content is too good man!! Thank you so much!! You are life saver!!
Meen, this video releaved me of several hours of trouble
Thanks a lot ! this is really a great way of explaining how things work !
Thank you! 🌟
excellent work man, keep going
Haha, haven't even posted this yet, glad you could find it hidden in the Playlist. Will post it tomorrow and thanks! I will
@@Flutterly
Could you make full example about what you explained not just a tips of code
I mean example that contains crud operations dealing with server
It's not an example
It's a small project 😅
I don't get it why this one has only 500 like xD, in mycase if I didn't watch this video, I swear I was 100% going to modify the state directly coming from js background
Thanks for this great tutorial! BTW, what extensions do you use in the vscode for equality and copyWith generation?
It's called Dart Data Class Genetator (Beta), thanks, I'll pin this comment so that everyone will know.
Thanks for this awesome video! I am looking forward to the next ones 😀
Thank you so much! ✨
This was really amazing. Thank you so much flutterly.
You're welcome! Thank you!
thank you very much, u have really made me understand equatable
I am so glad I did, you're welcome, mate! 🌟
keeeeeep posting pleasseee !!!! OMG you're a lifesaver ! and also if you can start building an e-commerce app from scratch ,it would be very useful .
thanks man !
Thank you so much! I will!
Awesome Video )
Thanks for this great tutorial.
You're welcome! Thanks! 🌟
Excellent, thanks!!
You're welcome, mate! 🌟
Hey thanks for your wonderful tutorial, but I have got a question.
Should we use equatable along with copyWith function for comparing our states? I am not sure why Equatable is neccessary here if Dart compares the instance by object instead of values by default. Whenver we create a new state instance by copyWith function, wouldn't Dart be able to compare already? It seems like it works as charm even if you didn't extend equatable from the tutorials above. Thank you
Man, as I stated inside the tutorial, copyWith and Equatable are 2 completely different things. If you want to compare two instances by value, you should extend Equatable or override the equal operator (==) as you wish. The copyWith method has nothing to do with comparing stuff. It is mainly used for creating a new instance from an already existing one, by mentioning the parameters that are changed in the new one compared to the old one (see the code in the tutorial).
Concise and clear 💙
Could you make a video on InheritedWidgets? Or how does Provider.of() cause a widget deep down the tree to be rebuilt while keeping its parents intact?
So much easier to understand when there are pictures 😁
Really enjoyed it!
Just one question => Must we use both copyWith and Equatable props together, or is only Equatable enough?
or just copyWith without Equatable because it works?
Thanks. It's either one or another, never both. Basically, Equatable is a simple version of copyWith() and hash() all together. I suggest that you only use Equatable. Thanks!
@@Flutterly why never both ? in some Felix Angelov projects he used Equatable and copywith at the same time ! take a look here : github.com/felangel/bloc/blob/master/examples/flutter_firebase_login/lib/login/cubit/login_state.dart
Sorry, I meant saying that you should use either Equatable or the override of the equality operator, never both (which makes sense) . My mistake, I'm sorry. I must've been tired when I replied. Sorry again. And yes, you can use copyWith with Equatable as they have nothing in common. They both have different purposes.
Some interesting topic for me :
- Bloc Observer
- Bloc Testing
- Injectible
- The initial Flow of an app, using bloc to Navigate between Onboarding, Login, Home
Mate, everything you mentioned is already covered in my tutorial series.
perfect , thanks bro.
You're welcome, bro
Amazing as always.
BTW, what programs/tools do you use to edit these videos?
I use multiple products like Videoscribe and Premiere Pro
Thank you so much I was stuck for hours trying and later realized that my props was empty 😭
Great tutorial, I understood all of your videos, I have one doubt Didn't we were sending same state in previous counter examples then how we were getting new state we didn't use copywith method in counterState, how it was working fine?
It's valuable content.
Hi Flutterly, Am facing issue with state update using bloc pattern. I have followed all the possibilities as you mentioned in the video like extending equatable and declaring all the properties in the state. but still am facing the same issue. Could you please help me out on this some how if possible.
Nice videos, what did you use for making it please ?
Yes its great : What do you use @Flutterly please ?
I use a combination between Videoscribe and Premiere Pro. 👍
Thank You!!!! Really usefull
You're welcome!
thank you bro,
You're welcome!
i do want to emit 2 states tho
example. i delete with 1 button 2 objects,
for each deleted object i want to show a bottom sheet for the user to review the object, so i emit 2 objects so 2 bottom sheets show up.
unfortunately the second emition closes the first bottom sheet.
I have a doubt.. all these states have only one or two variables and passed inside constructor from cubit. Consider if a state contains 10 variable and those 10 are not updated and used at same time. At each scenario a single state variable is updated. How can we do that?
With the copyWith method, you didn't pay enough attention to what I mentioned in the tutorial man.
If you'd have a class A with var a, b, c, d, e, f initilaised in the constructor, then you would have a copyWith method as I did in this tutorial from where you can class classObject.copyWit(only mention the parameters you want to update here)
I am extending Equatable in my state class AND emitting a NEW state but still nothing happens, what is the issue in this case?
hey thank you for make this videos
but i have question
i have case that i need change frequently list in my app
but when i emitting the state of my list i need to move the value to the new list because list is mutable
i try to not put my list inside props but like in your video i need to put all my field inside list porps
is there a way that i can still emitting my list without move to new list but still extends equatable ?
Thank you. I saw some examples using equatable but no one explained. I don't understand why use : super. I read something about initialize constructor, if compare with typescript or python or java this kind of constructor exist or it's just dart?
What extensions do you use for the folder theme?
The last tutorial of this series will be about everything I use, I can't really remember which icon pack it is, but I'll let you know then.
@@Flutterly Thank you mate!!
Thanks.
Do you have any real project example as I am not able to perform bloc on real project.
I will start a new tutorial series regarding real world examples and apps with bloc
Equatable is comparing by value, instead of comparing by reference
How to open pop up generator like that on vscode macos?
hey, @Flutterly is there anything wrong with changing appNotification/emailNotification bool variables with code like:
emit(state.copyWith(emailNotification: !state.emailNotification));
discarding newValue altogether and making toggleNotification methods parameterless?
How you get those Generate generate things? when you press command + . because I cant get those Generate things.. all I get is Wrap wih BlocBuilder, BlocSelector etc.. etc... no wrap with.... :(
Data Class Generator extension
hello i think putting const when declaring the instance solve the problem instead of using the equitable package
Perfect. And here I was thinking I'm the crazy one in my team to think mutating an object isn't the way to modify the sate.
I do have a question though. If you have a list of objects that could be re arranged and you want the state of all the objects and its values maintained throughout the app, what would be the correct way of doing so? I use GetX and I'm trying to incorporate good architecture with it. I used stream subscriptions in the sub controllers(blocs) to update when the values in the parent bloc changes. Problem is, that if the list is re ordered, the listener of that list is updated, but the listeners of the individual objects are not triggered since they are entirely new instances which were never subscribed to. What would be the correct way to approach this?
Great vid WCKD, your lessons are always great. I have a question for you. I did some experiments with the Equatable package, listing the props with the this.* form. The app seemed to work fine although I'm not sure quite why. I am guessing that since Equatable is used to compare Objects, then parameters contained in the instance works the same. I dunno for sure though... Do you have some clues?
"this.variable" is referring to the specific variable used inside the class. If it works fine for you, then it's ok!
What tool do you use for your video / drawing plz ?
VideoScribe ?
Yes
I love your contents but I have watched this video 2 times, but still didn't understand what Equatable stands for. How can I use in real lif scenario?
Also you said "Copy the content from the previous one to the new state"
so you mean if the "previous state is ONE"..... then.... "copy that prevoius state ONE to the new state" so now "the new state is ONE" ? I dont get it .. I would appreciate and understand if you give example of prev state and the new state :)
if you have a list as class field and emit not update a state - you must put FIELDNAME.hashcode in state props.
i fix this bug over 3 hours
One thing he didnt fully explain is why A cannot be equal to B. Even if they are both instances of myclass. The reason is they are not the SAME instance. If class is a blueprint then A and B were created with the same blueprint but they are not the same instance.
I would say this is literally from 0 to hero BLoc tutorial.
Thank you! 🌟