No video

Flutter Bloc & Cubit Tutorial

  Рет қаралды 121,083

Reso Coder

Reso Coder

Күн бұрын

📗 Written tutorial & starter project 👇👇
resocoder.com/...
📧 Get Flutter news 📰 and resources:
👉 flutter.education
👨‍💻 Do you write good code? Find out now!
resocoder.com/...
Bloc is a well-known and established library when it comes to state management in Flutter. It promotes good practices such as immutability and it has one of the best ecosystems of supporting packages and documentation built around it. In spite of all these benefits, using the Bloc package is painful at times and the cause is none other than boilerplate.
The version 6.0.0 and upwards of the Bloc package comes to make this library palatable to the masses! It gives you the ability to use a lighter version of Bloc called Cubit and removes a bunch of boilerplate.
Go to my website for more information, code examples, and articles:
● resocoder.com
Follow me on social media:
● / resocoder
● / resocoder
● / resocoder

Пікірлер: 170
@samuelobe5714
@samuelobe5714 4 жыл бұрын
I'm a simple man. I see a new Reso Coder video, I click...
@h3w45
@h3w45 4 жыл бұрын
2:57 going over the sample project 4:36 cubits vs other mutable state management 9:34 BLoC vs cubit 11:00 building app using cubit 37:10 building app using BLoC
@h3w45
@h3w45 4 жыл бұрын
thank you for covering the latest version of BLoC.
@SEOTADEO
@SEOTADEO 2 жыл бұрын
Thanks a lot for this good tutorial! I have been working part time for 6 months in a flutter project for a big IT company and never cared that much to understand this concept, but now I do and it makes everything a lot easier.
@mostafafahimi4588
@mostafafahimi4588 3 жыл бұрын
This channel is best flutter channel ever. Watched a lot of bloc tutorials but non was helpful like this.
@alex_moreno
@alex_moreno 4 жыл бұрын
I love the simplicity of cubit. Thanks for sharing this and compare the differences You are awesome
@mohamad20208
@mohamad20208 6 ай бұрын
This is the best explanation of the Bloc I've seen
@nawalhussein1891
@nawalhussein1891 4 жыл бұрын
You are an amazing teacher! Thank you. Bloc has been like a maze for me and you have helped me greatly in figuring it out. Thanks again.
@ResoCoder
@ResoCoder 4 жыл бұрын
Glad I could help!
@justconnor734
@justconnor734 3 жыл бұрын
@34:50 For "final weatherCubit = context.bloc();" it says "'bloc' is deprecated and shouldn't be used. Use context.read or context.watch instead. Will be removed in v7.0.0. Try replacing the use of the deprecated member with the replacement.". What is a good replacement for this code? Thanks EDIT for anyone interested its final weatherCubit = context.read(); intead
@alexandrufilipescu1301
@alexandrufilipescu1301 3 жыл бұрын
Thank you!
@jamesr2408
@jamesr2408 2 жыл бұрын
Thanks :-)
@mahdou3608
@mahdou3608 2 жыл бұрын
that is why i did not find it ,thank you
@juan_chan
@juan_chan 4 жыл бұрын
man, thats a really good explanation of this new feature, i dont even have a goods english skill and i completely understood what cubit and bloc is, thank you
@jamesdim
@jamesdim 4 жыл бұрын
You are the best source for bloc development! And always up to date!
@karthikraja6577
@karthikraja6577 4 жыл бұрын
Finally bloc tutorial 👍👍👍👍👍 How many more videos are there in the DDD flutter series ?? @resocoder
@ResoCoder
@ResoCoder 4 жыл бұрын
I think not more than 4.
@karthikraja6577
@karthikraja6577 4 жыл бұрын
@@ResoCoder eagerly waiting for them ! Take care and relax ! It's surely a hell of task to compile such a awesome course ! Great effort bro 👍
@mibi2007
@mibi2007 4 жыл бұрын
@@ResoCoder really good tutorial, thank you so much Matt
@kartavyabagga
@kartavyabagga Жыл бұрын
I guess now i can move forward to making a complete app. Thanks man!
@TheJaniable
@TheJaniable 3 жыл бұрын
Combined Cubit with Freezed.. and OMG what a result!
@bensalkb6902
@bensalkb6902 2 жыл бұрын
I like your coding practices like organising files and stuffs
@LeonardoCostaCoesta
@LeonardoCostaCoesta 3 жыл бұрын
Thanks since from Brazil, man! Keep going the good job!
@oblakus
@oblakus 3 жыл бұрын
Dude, thank you for this "eureka moment" that I just had!
@amartyakhan4700
@amartyakhan4700 4 жыл бұрын
Thanks a lot for this video! An in depth video/tutorial series about connecting a Flask/Django backend with a Flutter app would be amazing
@raunaksingh7512
@raunaksingh7512 2 жыл бұрын
Wow! This is a great course on Bloc library.
@Grovermol
@Grovermol 4 жыл бұрын
Nice tutorial, i'm finally understanding cubit and bloc, thanks dude. By the way what theme did you use in VsCode for the tutorial?
@kitkatv7150
@kitkatv7150 2 жыл бұрын
Great video tutorial👏! Thanks for formatting the vid to be straightforward. The website link helps so it can be easily followed. Looking forward to other awesome videos.
@raheemadamboev
@raheemadamboev 2 жыл бұрын
Thank you so much! It really helped me start with Bloc and Cubit. It is really similar to Jetpack ViewModel and Kotlin Flow pattern which is amazing!
@edungdivinefavour6977
@edungdivinefavour6977 3 жыл бұрын
Man. You got a new subscriber!!!!!!!!! This was so good. It cleared every question i had Thanks!!!!!
@thedudeabides8637
@thedudeabides8637 4 жыл бұрын
Thank you for this. As a noob developer, after really diving into this video and going through it a few times over a couple days, I FINALLY feel like I actually understand how Bloc/Cubit works and how to implement them into the first app that I'm building myself. I made major breakthroughs in my app after it all clicked for me with this video. And thank you for doing a tutorial on the updated Bloc/Cubit so soon after the major change, not much else out there that's up to date Lots of great flutter tutorials out there, Reso Coder rules them all. Thanks for the great work.
@danarputra9181
@danarputra9181 4 жыл бұрын
For first time using Bloc is hard And now in this video i know how is Bloc is worked
@akshaymarathe8133
@akshaymarathe8133 4 жыл бұрын
Sir please make a video of using bloc pattern along with json API
@phianh4545
@phianh4545 3 жыл бұрын
Thanks for your instructions, I love the way you organized your youtube channel and linked to your website, I'm doing with Bloc and now the cubit just remove the state file, which means will save my time alot. Really want to work with you some day, Peace out mate
@thewallstreetchokra
@thewallstreetchokra 3 жыл бұрын
best ever tutorial for beginners...SUBSCRIBED
@abduraimoff3090
@abduraimoff3090 2 жыл бұрын
Thank you so much ! It helped me a lot
@hq_net
@hq_net 7 ай бұрын
Everything is beautiful 😊😊
@easazade
@easazade 4 жыл бұрын
thank you for this my code just became so smaller using functions instead of events
@pedroricci1
@pedroricci1 4 жыл бұрын
Wow, great timing! Yesterday I was reading the documentation. Thanks!
@cristianbedoyavargas
@cristianbedoyavargas 3 жыл бұрын
Thank you so much for explaining this. I was looking for this for a while!
@jimaustin3608
@jimaustin3608 3 жыл бұрын
In learning state management (for flutter/dart development), I’ve been through with the setState design and the provider package; now looking at the BLoC pattern. BLoC ‘feels’ like imposing imperative design on a basically declarative (reactive) system, where provider seems a better fit for the flutter declarative framework. I don’t have good/bad opinions about this yet, just interested the views of those more experienced with flutter/dart .
@emmanuelvedastus5218
@emmanuelvedastus5218 2 жыл бұрын
Thanks a lot for this tutorial you realy saved my day im already your subscriber
@ahmedmaher-ez9xt
@ahmedmaher-ez9xt 3 жыл бұрын
thank you so much for your time and effort :) i'm learning from you a lot every day ... planing to finish TDD after this i will make a my start up project using TDD and will apply to remote job :) i will tell you when i got a job that your are the main reason of it ^_^
@peterwauyo2424
@peterwauyo2424 4 жыл бұрын
great explanations
@shrinivasmanjithaya2112
@shrinivasmanjithaya2112 Жыл бұрын
Clear explanantions..thank you so much..
@ShadowInfest
@ShadowInfest 4 жыл бұрын
Hey ResoCoder ;) Working on our app and needed to update Bloc. Thanks for this amazing video once again
@chanky262
@chanky262 3 жыл бұрын
Awesome tutorial, thats what i was looking for
@HashemRC
@HashemRC 4 жыл бұрын
always thanks for you quality tutorials. what's real difference between Bloc and Cubit? when should we use Cubit?
@mohad1062
@mohad1062 3 жыл бұрын
you are my hero man.
@yaseerahmed1325
@yaseerahmed1325 4 жыл бұрын
What an amazing tutorial. Easily the best👌👍
@FalStudio1234
@FalStudio1234 2 жыл бұрын
Awesome man, thanks a lot
@fritzjimenez9109
@fritzjimenez9109 4 жыл бұрын
Finally a new bloc tutorial
@Jdbluesky
@Jdbluesky 2 жыл бұрын
Muchas gracias hermano!!
@LeagueRandomPlayer
@LeagueRandomPlayer 4 жыл бұрын
Great Video i was waiting for this, GREAT GREAT JOB THANK YOU!!!!
@elistark9264
@elistark9264 4 жыл бұрын
This is what we are waiting for!
@HashemRC
@HashemRC 4 жыл бұрын
CyberWidget😉
@elistark9264
@elistark9264 4 жыл бұрын
@Hashem Aboonajmi 😉
@bryanmonsalvatge1696
@bryanmonsalvatge1696 3 жыл бұрын
Thank you for this video. Very helpful!
@johncerpa3782
@johncerpa3782 4 жыл бұрын
Great video, thank you
@semsax6862
@semsax6862 3 жыл бұрын
Just what I was looking for!!!
@thongtech1984
@thongtech1984 2 жыл бұрын
great work, thanks alot for your vids, you just saved my days.
@astronaute
@astronaute 4 жыл бұрын
There is no need to add "bloc" in pubspec.yaml, it’s pulled automatically with "flutter_bloc". Also, when using "const" constructors, you shouldn’t use "new" with them, it defies the (already limited) purpose.
@francoprofeti142
@francoprofeti142 3 жыл бұрын
I was thinking about the second thing while watching the video
@samiral7423
@samiral7423 3 жыл бұрын
please teach TDD with cubit
@akyna0wind
@akyna0wind 2 жыл бұрын
bravo! excellent totorial!
@landrygagne
@landrygagne 4 жыл бұрын
Great tutorial, thanks a lot! I was SOOOO depressed to see my app broken by flutter_bloc version upgrade. BTW, 6 major versions within 8 months for the flutter_bloc package, am I the only one shocked? Any chance to get some kind of stability for this package in the future? Otherwise you will be obliged to make a new tutorial every month!!!
@ResoCoder
@ResoCoder 4 жыл бұрын
Most of the changes are quite minor but by following the rules of semantic versioning, every breaking change has to automatically bump the major version number. I'm not opposed to doing tutorials though 😀
@engmahmoudahmed1984
@engmahmoudahmed1984 2 жыл бұрын
Amazing thanks 😊
@Fly16
@Fly16 3 жыл бұрын
amazing tutorial! by the way what's the font you are using?
@jonahlehner3855
@jonahlehner3855 3 жыл бұрын
Another great video!
@axehai
@axehai 4 жыл бұрын
Hey, great work as always, I wanted know why didn't you suggest using Equatables for checking equality, like in TDD tutorials?
@socinety
@socinety 2 жыл бұрын
Can I use equatable package along with cubits without overriding equality?
@makewebapp
@makewebapp 4 жыл бұрын
why not using an equatable package? Any specific reason? equatable: ^1.2.0
@aytunch
@aytunch 4 жыл бұрын
I want to know the same thing. Especially considering the same author wrote equatable with bloc
@ResoCoder
@ResoCoder 4 жыл бұрын
Just to not introduce yet another package into the tutorial. I guess it's simple enough that I should've used it though.
@nonsoedu4353
@nonsoedu4353 4 жыл бұрын
Me too taught equatable got obsolete for a minute or two there😌 ... Really nice tutorial though... understand the reason for cubit alot better now
@vladyslavmi
@vladyslavmi 2 жыл бұрын
*After v6.1.0, both context.bloc and context.repository are deprecated in favor of **context.read** and **context.watch*
@amirsohail7284
@amirsohail7284 Жыл бұрын
well explained
@nicolasdupere
@nicolasdupere 3 жыл бұрын
Great tutorials! Thanks
@davdev1695
@davdev1695 3 жыл бұрын
Thank you for this amazing tutorial. It explains really well the topic! Just one question: for every Cubit/Bloc in a project the states are usually Empty, Loading, Loaded & Error or there are other cases?
@programan6391
@programan6391 4 жыл бұрын
Great job, thank you.
@chinazaogwo5046
@chinazaogwo5046 4 жыл бұрын
Awesome tutorial. Please can you send the plugins you use for flutter development with vs code
@ahmedelbaghdady
@ahmedelbaghdady 4 жыл бұрын
very good i like your videos and i'm bloc fan like you thanks
@Fanaro
@Fanaro 4 жыл бұрын
Minor curiosity: "parenthesis" (singular), "parentheses" (plural). "Basis" (singular), "Bases"* (plural). They all come from Latin. * "Bases" can be the plural of either "base" or "basis".
@ethanhunt8316
@ethanhunt8316 4 жыл бұрын
Thank you so much, you are the best.
@geraldcampana9296
@geraldcampana9296 4 жыл бұрын
thanks for the tutorial!
@bmsrangel1
@bmsrangel1 3 жыл бұрын
Hey, man! How are you? First of all, congratulations for this tutorial! It helped me a lot with BLoC understanding! Dude, what is the best way to fix the warning "Close instances of `dart.core.Sink`."? I understand this warning helps to avoid memory leak due to opened streams left behind. I noticed that in Bloc code there's a close method. In this case, how do we handle it? Do we need to close the stream manually? Or it will be executed automatically?
@tiennghequyet1268
@tiennghequyet1268 3 жыл бұрын
thanks for the tutorial
@franfox
@franfox 3 жыл бұрын
Nice tutorial! I would like to ask you guys why was it not necessary to dispose the bloc in this case? thanks!
@ivanmartinez5239
@ivanmartinez5239 4 жыл бұрын
Right now I'm replacing blocs with cubits in a project, I think cubit is easier and less boilerplate than bloc. Edith: What font do you use? Looks great.
@lucassusanto
@lucassusanto 4 жыл бұрын
It's JetBrains Mono
@sidneymachara9773
@sidneymachara9773 3 жыл бұрын
Why do we pass the repository as a paramter to the cubit, rather than instantiating it inside the cubit . Nice tutorial. like how u explain and compare to other tools
@srihariayapilla4233
@srihariayapilla4233 3 жыл бұрын
Which vs code theme is thhis. Looks sooooo good.
@aduhglupa
@aduhglupa 2 жыл бұрын
Thank you for the tutorial. Can you show me the code using the "freezed" package?
@efesahin7168
@efesahin7168 3 жыл бұрын
what is the differences between cubit and bloc? why we use cubit if we deleted or switched them ?
@makymadi242
@makymadi242 4 жыл бұрын
Thanks Guy!!!
@Ryszardenko
@Ryszardenko 3 жыл бұрын
Awesome! Thanks! Can you explain how toi use freezed with State classes?
@TestingQuebec
@TestingQuebec 4 жыл бұрын
Thanks for the tutorial. I'm curious as to how the '^' works in the hashCode override for the Weather class? 'cityName.hashCode ^ temperatureCelsius.hashCode'
@RohithkannaDuraiswamy
@RohithkannaDuraiswamy 4 жыл бұрын
Woah. Can't believe this is on flutter dev LinkedIn page too, lol
@mual77
@mual77 4 жыл бұрын
Good job!
@ahmadfajrulfalah
@ahmadfajrulfalah 4 жыл бұрын
why not use equatable instead?
@ResoCoder
@ResoCoder 4 жыл бұрын
I don't want to introduce unnecessary packages to tutorials about a particular library.
@ahmadfajrulfalah
@ahmadfajrulfalah 4 жыл бұрын
@@ResoCoder i see, nice tutorial btw 👍
@StefanoSaitta
@StefanoSaitta 4 жыл бұрын
Great content as always, in your opinion it makes sense to mix cubit and bloc in your app? What a bloc can do that a cubit can't?
@ResoCoder
@ResoCoder 4 жыл бұрын
Thanks, Stefano! Bloc can, for example, transform its incoming events with debounceTime from RxDart. This is useful for auto-search where you don't want to necessarily trigger an API call for every inputted character.
@mallikarjunreddy5229
@mallikarjunreddy5229 4 жыл бұрын
Hey Matt, great explanation. Could you please help me out on how to generate boilerplate code like bloc extension.
@user-gp1tr4kr4d
@user-gp1tr4kr4d 4 жыл бұрын
Cool !
@arifikhsanudin9724
@arifikhsanudin9724 4 жыл бұрын
Hi Reso
@snaidher5
@snaidher5 3 жыл бұрын
Hi , please could you make an example of using firebase with cubit, please!
@virenkhatri1932
@virenkhatri1932 3 жыл бұрын
Why didn't you use equatable instead of == and hashcode overrides?
@knotcircle2844
@knotcircle2844 2 жыл бұрын
Thank you for this video. I'm still new to flutter and I'm trying to develop cubits in an App. I'm lost on how to communicate the button tap/press event that calls an API get data and rebuild the UI and render it on a DataTable
@jktan5793
@jktan5793 4 жыл бұрын
Hi @reso coder I have question about GetX, I am not sure what do you think about that library. thanks for sharing your knowledge and opinion.
@DiwakarSerala
@DiwakarSerala 4 жыл бұрын
Hi any idea what to do with this warning: Close instances of `dart.core.Sink`
@ranjithjagadees422
@ranjithjagadees422 3 жыл бұрын
you can replace with context.bloc()..add(GetWeather(cityName));
@i.k.shaikh3772
@i.k.shaikh3772 4 жыл бұрын
Hey Thanks for this brightening tutorial, i am trying to pass an index of files in a directory to a listview, could you help me with that ??
@dalriada33
@dalriada33 3 жыл бұрын
One question: is it important to provide the FakeWeatherRepository from outside to the Cubit through its constructor? Is there some disadvantages if I create an instance of it inside the Cubit?
@nileshbhakre7050
@nileshbhakre7050 4 жыл бұрын
overriding equality can have been avoided using equatable, isn't cubit boilerplate comes with equatabel in it? by the way great tutorial as always...
@nested9301
@nested9301 3 жыл бұрын
i understand all state managment packages and i never understand bloc ...
@efesahin7168
@efesahin7168 3 жыл бұрын
hey why did not use listener in weather_bloc.dart page ? In previous video which is counter app, we used to constructor with listen function. i mention that: CounterBloc() { counterEventController.stream.listen(mapEventToState); } like this.
@rubendarioguarnizomartinez2765
@rubendarioguarnizomartinez2765 2 жыл бұрын
What is the difference between BLOC builder and BlocConsumer?
Flutter Riverpod Tutorial - The Better Provider
41:26
Reso Coder
Рет қаралды 85 М.
KMP vs. Flutter - Who Will Win The Cross-Platform Battle?
16:19
Philipp Lackner
Рет қаралды 44 М.
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 21 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
Купил?  Страдай!  - 2 года боли и украденный Утиль!
47:17
Bloc Library - Painless State Management for Flutter
24:54
Reso Coder
Рет қаралды 92 М.
Flutter Cubit BLoC State Management Explained
20:42
dbestech
Рет қаралды 22 М.
Learn to use Isolates in Flutter | Simplified
10:28
CodeX
Рет қаралды 26 М.
What is BLOC in flutter
10:13
Hitesh Choudhary
Рет қаралды 63 М.
Bloc Library: Basics & Beyond - Felix Angelov | Flutter Europe
46:16
Flutter Europe
Рет қаралды 58 М.