Cubit State management - Light Weight combination of BloC and Provider

  Рет қаралды 20,939

Flutter Explained

Flutter Explained

Күн бұрын

Пікірлер: 67
@ookamiueru
@ookamiueru 4 жыл бұрын
Thank you for this excellent tutorial. How it should be done. It seems the world of flutter and in particular flutter_bloc changes a bit rapidly. I just went through the video, and it looks like with Cubit now merging into the Bloc library, there are some renames here and there. In particular, imports for flutter_bloc cover cubit as well. onTransition are now onChange. CubitObserver is BlocObserver, CubitBuilder is BlocBuilder, CubitListener is BlocListener. In the pubspec, you only need flutter_bloc: ^6.0.1
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Thank you I will take an eye on it :)
@ookamiueru
@ookamiueru 4 жыл бұрын
@@FlutterExplained i might be a bit confused myself. It looks like cubit is now part of bloc, and flutter_bloc integrates with both cubit and bloc. Either can be used interchangeably, so your tutorial will work with the renames I mentioned. One could also use Bloc instead, but that adds a layer of events that need to be mapped to states. A little bit more heavy handed, but could solve particular use cases. The recommendation according to docs is to, if unsure, start out with Cubits, and convert them on a need basis to Blocs. It's such a great work to have these somewhat overlapping solutions to be consolidated into one coherent solution. Absolutely great stuff
@FlutterExplained
@FlutterExplained 4 жыл бұрын
@@ookamiueru You are right, the problem was that this video was released exactly one week before the merge into BloC has been announced, so I had not the time yet to update the tutorial. But I will as soon as I find the opportunity. Sorry for the inconvenience and thanks for your fantastic explanation of what to do, I will pin your comment so that everyone who joins that video can see your solution.
@ookamiueru
@ookamiueru 4 жыл бұрын
@@FlutterExplained it was of no inconvenience. I had some familiarity with the concept, so the mapping to the changes was fairly straight forward. I'm just happy you made the tutorial, as even with the changes, I still find it to be a great explanation for how it works. It's just a few renames :-)
@FlutterExplained
@FlutterExplained 4 жыл бұрын
@@ookamiueru Amazing :) I am super happy that it helped you.
@josegeorges5914
@josegeorges5914 4 жыл бұрын
I love felix and love this! He's been my pilar on flutter dev and can't thank him enough for such a smooth path onto Flutter!
@ezzypoo7909
@ezzypoo7909 4 жыл бұрын
Apart from the great tutorial, it’s also fantastic to see this guy get better at speaking while being recorded. Based off the accent it sounds like English is his second language and in his first videos it definitely shows, but now in more recent videos you can barely tell. Always nice to see people improving in areas besides coding!
@FlutterExplained
@FlutterExplained 4 жыл бұрын
I don't even know what to say, thank you so much! That was one of the biggest compliments that you could give me :). I believe to write a script beforehand helps to improve the language, and I hope I can transfer that to my live streams as well :)
@vireshpeshen5738
@vireshpeshen5738 4 жыл бұрын
Just when i was finding a cubit tutorial , i found yours
@AbhideepChakravarty
@AbhideepChakravarty 3 жыл бұрын
Felt like looking into a solution without knowing the problem well. Somehow I could not learn watching it once. Only thing I felt, there are things to be learnt.
@FlutterExplained
@FlutterExplained 3 жыл бұрын
Sorry to hear that, I will see if I can improve it whenever I do my Bloc Video. Thank you very much for your feedback!
@danilakalish1091
@danilakalish1091 4 жыл бұрын
You can use the todo tree extension to better control the todo in visual code
@huycao8521
@huycao8521 2 жыл бұрын
Thank you sir for a very clear tutorial !
@FlutterExplained
@FlutterExplained 2 жыл бұрын
You are welcome!
@xcodesnippets863
@xcodesnippets863 4 жыл бұрын
Great Tutorial man. Subbed. Regarding viewing the Todos, you can use the Todo Tree extension for VS code to view them without having to search it.
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Fantastic I will have a look! Thanks for sharing.
@xcodesnippets863
@xcodesnippets863 4 жыл бұрын
Glad I could be of help. Also, looking forward to your video on Riverpod, if you ever decide to make one that is.
@pol12ris
@pol12ris 4 жыл бұрын
Nice one... btw that was quick... Cubit just got released and we have a video also. cool.
@theredcap_yt
@theredcap_yt 4 жыл бұрын
You can use TODO Tree Extension in VS Code
@KawsarAhmed-qq4sj
@KawsarAhmed-qq4sj 4 жыл бұрын
Thanks for excellent tutorial. you guys done wonderful job. your accent and explanation is good and understandable. can you please make another video or update this video with latest flutter_bloc.
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Thank you it is great to hear that you enjoyed it :).
@himanshumistry3336
@himanshumistry3336 3 жыл бұрын
CubitProvider is BlocProvider(need to import package), MainCubitOberver is MainObserver
@FlutterExplained
@FlutterExplained 3 жыл бұрын
There have been a great update on the repository in our state tutorial from David it should now follow the correct use cases :)
@LeagueRandomPlayer
@LeagueRandomPlayer 4 жыл бұрын
Great video dude!
@fredericklane745
@fredericklane745 3 жыл бұрын
For those of us new to Cubit, maybe at the beginning of the video, show how it actually functions on the app and maybe present a graphical of how it works in the back-end?
@marctan7001
@marctan7001 2 жыл бұрын
thanks for this! what do you prefer in flutter? redux or cubit?
@jrheisler
@jrheisler 4 жыл бұрын
Interesting, a nice Cubit video, thanks, and on the same day a Riverpod video from someone else. Will there ever be only one?
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Most likely not :) there are a lot of people doing great stuff.
@petroniobonavides3530
@petroniobonavides3530 4 жыл бұрын
@Flutter Explained Hello, Dont you know GetX? State simple/reactive management(without codegen), route Management and Dependencies management 3-IN-1. This is a hidden and powerful tool that nobody talks about. Could please do some content. This package is gonna surprise you, definitely... Thx a lot
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Thanks for pointing that out, we will absolutely take a look into it, and it is already in our Pipeline.
@FlutterExplained
@FlutterExplained 4 жыл бұрын
I had a conversation with Felix, and he found some additions. I mutated the state which you should not to, check out the Repository I added the hotfix and improved the solutions with this. You can find the addition in the link below: github.com/md-weber/state_tutorials/pull/2
@MohammedJavad
@MohammedJavad 3 жыл бұрын
Everyone please be aware that flutter_cubit is discontinued and its been merged with flutter_bloc
@MrVipulLal
@MrVipulLal Жыл бұрын
Very good video
@FlutterExplained
@FlutterExplained Жыл бұрын
Thanks mate :)
@tessertaha
@tessertaha 4 жыл бұрын
Great video!
@HimanshuYT
@HimanshuYT 4 жыл бұрын
Awesome! ❤️
@adbysantos6603
@adbysantos6603 3 жыл бұрын
Good video!
4 жыл бұрын
Cubit is very good :D
@yooscripts5947
@yooscripts5947 4 жыл бұрын
nice tutorial but i could not find flutter_cubit on pub.dev i think they merge it into flutter_bloc so i used it but CubitObserver does not exit on
@FlutterExplained
@FlutterExplained 4 жыл бұрын
That could be I think with the merge into BloC it works now with the Bloc Observer: Bloc.observer = MyBlocObserver(); pub.dev/packages/bloc#overview
@programan6391
@programan6391 4 жыл бұрын
NIce tutorial. So, cubit can replace bloc? It's much more clean.
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Well, it will not replace it, but it gives you an alternative if you do not want to have the huge boilerplate with Events. It is useful if you want to work with a lightweight solution. But keep in mind there will be additional changes because it is currently in version 0.1 and Felix is working actively on it. Therefore it could lead to breaking changes in the future.
@gokulakrishnan1977
@gokulakrishnan1977 4 жыл бұрын
what is the font or extension you using ( I like this => )
@FlutterExplained
@FlutterExplained 4 жыл бұрын
That is Fira Code Medium with Font Ligratures. I created a video how to add that in your IDE. twitter.com/flutter_exp/status/1252857128131256321?s=19
@elmeroranchero
@elmeroranchero 3 жыл бұрын
will that rebuild the whole thing if a new drink is added?
@FlutterExplained
@FlutterExplained 3 жыл бұрын
Good question, I would have to check that once more it has been a while :)
@elmeroranchero
@elmeroranchero 3 жыл бұрын
@@FlutterExplained I would appreciate a deep look at this kind of problem in a future video. :)
@soheibbettahar1996
@soheibbettahar1996 4 жыл бұрын
The flutter_cubit packages is marked discontinued ::
@FlutterExplained
@FlutterExplained 4 жыл бұрын
That is correct you can find it in the Bloc package now it has been merged in the other comments you can find how to change it to the correct package :)
@nepalcodetv6298
@nepalcodetv6298 4 жыл бұрын
flutter with rest api which state management should i use? like realestate app
@FlutterExplained
@FlutterExplained 4 жыл бұрын
Any, if you are beginner I would recommend try it to solve with StatefulWidgets and if it is not enough anymore try to improve with a more advanced solution like Provider, BloC or MobX.
@dudubaiao
@dudubaiao 4 жыл бұрын
I think you should have used immutability all the way down. Having only the list immutable is not enough if you mutate the drink object directly.
@FlutterExplained
@FlutterExplained 4 жыл бұрын
That is correct, I think I added somewhere a comment or changed it already in the GitHub repository. Maybe I will update this video at some time :)
@elmeroranchero
@elmeroranchero 3 жыл бұрын
What does "...state" do in the children section of the Column?
@FlutterExplained
@FlutterExplained 3 жыл бұрын
Hi Daniel, (...) is a so called spread operator, and it flattens a list into its single elements. Feel free to have a look here: dart.dev/guides/language/language-tour#spread-operator
@elmeroranchero
@elmeroranchero 3 жыл бұрын
@@FlutterExplained yeah I understand the spread operator but why do we need it there, can´t we just pass state as it is?
@FlutterExplained
@FlutterExplained 3 жыл бұрын
Unfortunately no, because the state is from type List of drinks but we use the map on the state and return for each drink a widget that can be spread into the list of the Column.
@elmeroranchero
@elmeroranchero 3 жыл бұрын
@@FlutterExplained but can't it be state.map etc ? Maybe I'm missing something very obvious
@amarpreetsingh857
@amarpreetsingh857 3 жыл бұрын
If aap restart data lost in cubit?
@FlutterExplained
@FlutterExplained 3 жыл бұрын
Yes Cubit is just a state management tool, not a Database. For that you will use something like Hive or SharedPreferences or a real Database like Firebase or a Server with Postgre.
@killDJuice
@killDJuice 4 жыл бұрын
download TODO tree in VS code
SharedPreferences for Dark and Light Theme - Flutter Explained
5:41
Flutter Explained
Рет қаралды 8 М.
Provider State management - ChangeNotifier + Flutter
18:28
Flutter Explained
Рет қаралды 27 М.
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36
Every parent is like this ❤️💚💚💜💙
00:10
Like Asiya
Рет қаралды 24 МЛН
Flutter Bloc & Cubit Tutorial
47:58
Reso Coder
Рет қаралды 121 М.
Riverpod Simplified | Easy State Management
14:17
Tadas Petra
Рет қаралды 44 М.
Bloc Library: Basics & Beyond - Felix Angelov | Flutter Europe
46:16
Flutter Europe
Рет қаралды 58 М.
Flutter Bloc Tutorial - Bloc or Cubit?
12:12
Code With Cypert
Рет қаралды 8 М.
BLoC Pattern with Flutter || State Management
22:50
CodeX
Рет қаралды 95 М.
Flutter BLoC and Cubit | Day 13 - #30DaysOfFlutter
21:51
Kilo Loco
Рет қаралды 20 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
Flutter State Management - The Grand Tour
14:07
Fireship
Рет қаралды 243 М.
Easiest way to understand BLOC Pattern in Flutter
15:52
Easy Approach
Рет қаралды 96 М.
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36