Flutter Bloc Tutorial For Beginners | BLoC Architecture/Pattern & State Management Explained

  Рет қаралды 87,617

Rivaan Ranawat

Rivaan Ranawat

Күн бұрын

In this course, we will learn about the Flutter Bloc State Management Tool along with the BLoC Architecture/Pattern by creating 4 Projects using Flutter! We will learn about Bloc, Cubit, BlocProvider, BlocBuilder, BlocConsumer, BlocListener, RepositoryProvider, BlocObserver and various methods and functionalities they offer. Along with that, we'll learn about Bloc vs Cubit, understanding when to use what and just simplifying Bloc down by a lot. We'll also learn about writing clean code by implementing BLoC Pattern in an API Powered Project.
Source Code: github.com/Riv...
📌 Discord Server - / discord
Resources:
20 Hours Flutter Beginners Course - • The Complete Dart & Fl...
Provider in 7 Minutes - • Flutter Provider State...
ToDo List Beginner Files - github.com/Riv...
Login Form App Beginner Files - github.com/Riv...
Weather App Beginner Files - github.com/Riv...
Timestamps:
(00:00:00) Introduction
(00:00:44) Project Setup + Bloc Installation
(00:03:39) Counter App With Cubit State Management - Overview
(00:30:38) Counter App With Bloc State Management - Overview
(00:49:48) Similarity Between Bloc & Cubit
(00:50:18) Todo List App With Cubit - BlocBuilder, onChange, onError
(01:11:59) Login Form App with Bloc - States, Events, BlocListener, BlocConsumer, onTransition, bloc_concurrency
(01:56:31) BlocObserver
(02:01:09) Weather App - BLoC Architecture Pattern
(02:30:18) BLoC Pattern Recap
(02:33:36) Is BLoC Unnecessary work?
(02:34:15) Conclusion
Connect With Me Here:
GitHub: github.com/riv...
Linkedin: / rivaan-ranawat
X: x.com/RanawatR...
Medium: / namanrivaan
Instagram: / optimalcoding

Пікірлер: 215
@GameSteals
@GameSteals 3 ай бұрын
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.
@RivaanRanawat
@RivaanRanawat 2 ай бұрын
Good explanation, thanks for taking the time to write & help others!
@sagarshah5341
@sagarshah5341 2 ай бұрын
Man you are good at DSA!
@jatindersinghaujla
@jatindersinghaujla Ай бұрын
​@@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
@sagarshah5341
@sagarshah5341 Ай бұрын
@@jatindersinghaujla The guy understood what I was implying.
@andrewspourgeon
@andrewspourgeon 21 күн бұрын
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
@MrxAmjad
@MrxAmjad 8 ай бұрын
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 ❤❤❤❤❤.
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you so much!!
@yarachesu2604
@yarachesu2604 3 ай бұрын
It is hard working not a gift.
@AkshayGupta-qb1yn
@AkshayGupta-qb1yn 10 күн бұрын
You're a genius! Unlike other KZbinrs 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!
@LinuxUser_
@LinuxUser_ 8 ай бұрын
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 🙏🏻
@hashir2749
@hashir2749 4 ай бұрын
Seen a lot of state management tutorials but this one is on Top.
@kevinvishal9071
@kevinvishal9071 5 ай бұрын
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.❤
@samuelvmoura
@samuelvmoura 4 ай бұрын
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!
@synnotus
@synnotus 8 ай бұрын
You are the best thing ever happened to flutter. Your explanations are beginner friendly. Thanks
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!
@Basslanyience
@Basslanyience 21 күн бұрын
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.
@pratyushvaibhav
@pratyushvaibhav 8 ай бұрын
Hats off A big round of applause ✋ A big thanks for this 🙏
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
My pleasure!
@Vikram_Naik
@Vikram_Naik 14 күн бұрын
Manhhhh! This is the best tutorial out in KZbin for bloc state management You are amazing
@Mitsue51
@Mitsue51 5 ай бұрын
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
@numan947
@numan947 4 ай бұрын
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.
@richardwindley7355
@richardwindley7355 7 ай бұрын
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.
@DataSet
@DataSet 6 ай бұрын
For those who don't know, Rivaan is only 17
@c00per_
@c00per_ 4 ай бұрын
Ikrrrr💀🗿💥
@rakshithadilshan9888
@rakshithadilshan9888 6 ай бұрын
Very valuable content. No one has taught like this❤
@KhawarShahzad-lj9gh
@KhawarShahzad-lj9gh 26 күн бұрын
For first time I saw a tutorial completely. 🙂
@SohaibSanaa
@SohaibSanaa 6 ай бұрын
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) 💯❣💫
@anurudhsingh3397
@anurudhsingh3397 6 ай бұрын
I have no words!! Fluent like air!!!! Thanks !!!!
@RivaanRanawat
@RivaanRanawat 5 ай бұрын
Thank you!
@jatindersinghaujla
@jatindersinghaujla Ай бұрын
This video is worth watching. You cleared so many doubts.
@roninspect4357
@roninspect4357 8 ай бұрын
a big project with bloc and supabase would be very awesome & unique.
@rolesquare3624
@rolesquare3624 8 ай бұрын
I was wondering when Rivaan will move to bloc and here it is. Thank you for showing me a lot in flutter.
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
My pleasure!
@VaibhavC-co1bi
@VaibhavC-co1bi 6 ай бұрын
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
@RivaanRanawat
@RivaanRanawat 6 ай бұрын
Will be coming soon, hopefully March!
@hussainrizvi5423
@hussainrizvi5423 7 ай бұрын
OH MY GOD!!! THANK YOU SO MUCH SIR... this is by far the best video for bloc tutorial.
@RishabhTiwari-v3l
@RishabhTiwari-v3l 23 күн бұрын
A Very Big Thanks to You Sir ❤❤
@andrewspourgeon
@andrewspourgeon 21 күн бұрын
Dear Rivaan , U have an excellent explanation skills bro ❤‍🔥 , This one is a gem 😍
@hokitamo
@hokitamo 6 күн бұрын
best teacher ever!
@arnaudroncari2468
@arnaudroncari2468 7 ай бұрын
Such a great teacher !
@RivaanRanawat
@RivaanRanawat 6 ай бұрын
Thank you!
@muhammadbilal-sd9kf
@muhammadbilal-sd9kf 4 ай бұрын
Your way of explaining bloc pattern is amazing. Please make a video of about MVVM architecture using provide. thanks
@hurbangash1302
@hurbangash1302 4 ай бұрын
i did not know bloc was so easy .thank you so much rivan bhai
@jayisampelliwar5065
@jayisampelliwar5065 8 ай бұрын
finally, the Most awaited video ✅ best flutter channel exists on YT
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!!
@malukishtiaq
@malukishtiaq 5 ай бұрын
You are just awesome my friend. I watch your videos on priority. It helps me stay polished.
@arminyazdian6598
@arminyazdian6598 4 ай бұрын
Thank you so much for putting huge amount of time and effort!
@manohar.acharya
@manohar.acharya 8 ай бұрын
was despereatly waiting for bloc wanna see fullstack project on bloc & cubit
@its_suresh_v
@its_suresh_v 7 ай бұрын
Riwan love you man the way you explained bloc outstanding brother, Crystal-clear explanation superb 👏
@nisafv.a8710
@nisafv.a8710 8 ай бұрын
Thankyou so much maaan . Really helpful ❤ . God bless
@aizen_3438
@aizen_3438 8 ай бұрын
Hats off waiting for this 🔥
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Hope it was helpful!
@alanta335
@alanta335 3 ай бұрын
best tutorial i heard in a long time🤩
@RivaanRanawat
@RivaanRanawat 3 ай бұрын
Thanks!
@justetk
@justetk 2 ай бұрын
Nice Video! Thanks from Azerbaijan!
@faridahmadov5991
@faridahmadov5991 7 ай бұрын
You are the best tutor ever!
@RivaanRanawat
@RivaanRanawat 7 ай бұрын
Thank you!!
@chitko1706
@chitko1706 7 ай бұрын
awesome sir. you are the mentor who i was looking for🎉.please,upload more.
@Badshah1614
@Badshah1614 8 ай бұрын
Thank you so much sir for uploading a new flutter video again . How long have we been waiting for your next Flutter video?
@maulahaz
@maulahaz 8 ай бұрын
MashaAllah.. very good explanation. Deep like diving in the ocean. Recommended to watch.
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!
@sabinpoudel6969
@sabinpoudel6969 8 ай бұрын
Rivaan you are gem for a flutter community. Thanks for clearing my doubts.!!!
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Glad it was helpful:)
@user-zq1il5lj4h
@user-zq1il5lj4h 3 ай бұрын
An Advantageous tutorial.👋
@RivaanRanawat
@RivaanRanawat 2 ай бұрын
Glad you think so!
@muammar88
@muammar88 5 ай бұрын
Man you rock! Thanks a lot for sharing your expertise ❤
@aouadicharaf1038
@aouadicharaf1038 4 ай бұрын
finished!! Amazing content ❤❤❤
@RivaanRanawat
@RivaanRanawat 3 ай бұрын
Thank you!
@amityadav85
@amityadav85 7 ай бұрын
brilliant! thank you kind sir! very nice method of teaching!
@abidhasansnigdho
@abidhasansnigdho 8 ай бұрын
You are awesome at making complex things easy ❤
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!
@LelloApp
@LelloApp 3 ай бұрын
it was fantastic!!! thanks
@RivaanRanawat
@RivaanRanawat 3 ай бұрын
Glad you liked it!
@muhammadjavedrafique4592
@muhammadjavedrafique4592 8 ай бұрын
oh yrr Rivan i dont know who told you what we need on which time 🤣🤣.... tnku Gem
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Hahaha, thank you!
@footballace8371
@footballace8371 28 күн бұрын
Please do a video on Stacked MVVM Architecture
@scorpionadvertising8808
@scorpionadvertising8808 Ай бұрын
He is a better teacher than a coder😂
@pravinprince3221
@pravinprince3221 8 ай бұрын
Thank you for the wonderful tutorial bro, it is very helpful for me and my team thanks again
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
My pleasure!
@pallabroy8800
@pallabroy8800 8 ай бұрын
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
@livingfreeely
@livingfreeely 4 ай бұрын
thanks a lot Rivaan
@arthonuy7211
@arthonuy7211 8 ай бұрын
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?
@sujalutekar9417
@sujalutekar9417 8 ай бұрын
I was waiting for this only 🔥🔥
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Hope it helps!
@techwithotabek
@techwithotabek 6 ай бұрын
Hey Rivaan, great tutorials brother. Can you also make a tutorial for Provider like you did for Bloc?
@RashidKhan-kd9xl
@RashidKhan-kd9xl 4 ай бұрын
He had it.. you can see it ( in his 3rd app in 20h course of flutter for beginners) but there nothing much in providers ❤
@user-hq6ul4ob2z
@user-hq6ul4ob2z 7 ай бұрын
Outstanding Explanation.....
@RivaanRanawat
@RivaanRanawat 6 ай бұрын
Thank you!!
@azamovdev
@azamovdev 7 ай бұрын
Good Bro I wish luck your works
@aash1r869
@aash1r869 8 ай бұрын
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!
@user-rk3me5st3q
@user-rk3me5st3q 6 ай бұрын
this is pure gold
@PaoloTshiyole
@PaoloTshiyole 8 ай бұрын
That's amazing, good video May you do a video with flutter and gemini pro api please
@Eunsmoqj
@Eunsmoqj 5 ай бұрын
You are insane. Thx for everything. Im learning from u a lot.
@sagarshah5341
@sagarshah5341 2 ай бұрын
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();
@user-gl8mz7jm4l
@user-gl8mz7jm4l 5 ай бұрын
can you create the video like how can we dependency inject, using the annotation, and using of json serizable and more
@hurbangash1302
@hurbangash1302 4 ай бұрын
rivan bhai next responsive design tutorail please
@pravinprince3221
@pravinprince3221 5 ай бұрын
Good morning bro one more request bro can you please do detailed videos on bloc_concurrency and transformer like this one please
@shhhhh.
@shhhhh. 5 ай бұрын
Great video 👌👌👌
@rifkiardiansyah616
@rifkiardiansyah616 5 ай бұрын
Bro, you saved me
@ndonnayacynth1991
@ndonnayacynth1991 3 ай бұрын
Thank you so much
@RivaanRanawat
@RivaanRanawat 3 ай бұрын
Pleasure!
@user-bg1ks1rq4o
@user-bg1ks1rq4o 8 ай бұрын
Amazing video, that's very good
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!
@pradeepg4498
@pradeepg4498 8 ай бұрын
How to handle stream and bloc state value in another bloc
@faheemahmadofficial7701
@faheemahmadofficial7701 8 ай бұрын
Thanks great help, would like to see firebase full using clean arvh and cubit all cruds fcm cloud functions and model based work
@__basith__742
@__basith__742 7 ай бұрын
see you should also include stream subscrption using bloc it would be every much appreciated
@kobab4270
@kobab4270 5 ай бұрын
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"
@user-nt3oq6cp5n
@user-nt3oq6cp5n 5 ай бұрын
your video is very useful! So, i have one Question, Is there any no need domain layer that use in clean architecture?
@Revanth233
@Revanth233 8 ай бұрын
Tqsm bro for making videos most beautiful 😍
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Most welcome!
@zaitoontech
@zaitoontech 5 ай бұрын
Awesome thanks bro
@jainambarbhaya1736
@jainambarbhaya1736 8 ай бұрын
so which is more recommended Bloc or Riverpod ?
@user-cd5mk5rv9d
@user-cd5mk5rv9d 6 ай бұрын
Such a great Tutorial.
@RivaanRanawat
@RivaanRanawat 6 ай бұрын
Thanks, glad you liked it!
@hiteshnath7729
@hiteshnath7729 4 ай бұрын
Bro can you send your vscode settings json, I loved your theme ❤
@faridahmadov5991
@faridahmadov5991 8 ай бұрын
Quite good explain
@manulagadec6846
@manulagadec6846 5 ай бұрын
23:40 🤣 you're the goat
@River-mm6jw
@River-mm6jw 8 ай бұрын
Part 2 : Bloc + Freezed with Clean Architecture
@ramandahiya6977
@ramandahiya6977 5 ай бұрын
well explained
@usmanofficial4881
@usmanofficial4881 4 ай бұрын
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
@code_-rq1wh
@code_-rq1wh Ай бұрын
which file icon theam your are useing
@jayisampelliwar5246
@jayisampelliwar5246 8 ай бұрын
Which theme are you using? Could you please tell me the name ???
@mohamed1khaled2
@mohamed1khaled2 8 ай бұрын
.
@mohamed1khaled2
@mohamed1khaled2 8 ай бұрын
write this in search and we found the theme 'eserozvataf.one-dark-pro-monokai-darker' the name is One Dark Pro Monokai Darker theme
@nullcodeer
@nullcodeer 8 ай бұрын
great boss...................
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thanks!
@drreload6726
@drreload6726 8 ай бұрын
Please give a tutorial for getx. Not able to find proper documentation.
@madmilitiangaming5694
@madmilitiangaming5694 8 ай бұрын
amazing content
@HGHG-yn4uo
@HGHG-yn4uo 6 ай бұрын
You are the best 😘😘
@RivaanRanawat
@RivaanRanawat 6 ай бұрын
Thank you!
@akshatt25
@akshatt25 8 ай бұрын
Rivaan It would be really great if you make a Spotify clone (integrating Spotofy API) it's API is considered to be real tough
@szyszak9424
@szyszak9424 8 ай бұрын
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?
@fidelahm3027
@fidelahm3027 4 ай бұрын
how to grant permission to open user system settings??
@de-day1882
@de-day1882 6 ай бұрын
Hey Rivan, if you got any time(free) can u make a video on backend dart_frog, about its advantages and dis-.
@joelmathew3253
@joelmathew3253 8 ай бұрын
Great one
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thanks Joel!
@mohammadsaidi880
@mohammadsaidi880 8 ай бұрын
love love love from Bangladesh
@RivaanRanawat
@RivaanRanawat 8 ай бұрын
Thank you!
Flutter Unit Testing Tutorial For Beginners - Practical Guide
1:06:54
Rivaan Ranawat
Рет қаралды 33 М.
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 54 МЛН
Box jumping challenge, who stepped on the trap? #FunnyFamily #PartyGames
00:31
Family Games Media
Рет қаралды 30 МЛН
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 45 МЛН
Top 30 Flutter Tips and Tricks
6:50
Flutter Mapp
Рет қаралды 548 М.
Riverpod or Bloc? Which One is Better?
3:44
Flutter Guys
Рет қаралды 41 М.
React Native CLI Setup for Windows [Created in 2024]
25:02
CodeLegends
Рет қаралды 4,3 М.
The First Step To Clean Architecture | Flutter SOLID Principles
28:27
Rivaan Ranawat
Рет қаралды 15 М.
Flutter Provider EASY Tutorial
9:43
Flutter Mapp
Рет қаралды 47 М.
Most overpowered way to build mobile apps?
8:33
Beyond Fireship
Рет қаралды 765 М.
Can We Create New Elements Beyond the Periodic Table?
18:07
PBS Space Time
Рет қаралды 304 М.
Zustand Tutorial for Beginners - The Only Course You Will Ever Need
1:10:21
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 54 МЛН