Flutter TDD Clean Architecture Course [10] – Bloc Scaffolding & Input Conversion

preview_player
Показать описание
📗 Learn from the written tutorial 👇👇

Presentation layer contains the UI in the form of Widgets and also the presentation logic holders, which can be implemented as a ChangeNotifier, Bloc, Reducer, ViewModel, MobX Store... You name it! In the case of our Number Trivia App though, we're going to use the flutter_bloc package to help us with implementing the BLoC pattern.

👨‍💻 Do you write good code? Find out now!

Go to my website for more information, code examples, and articles:

Follow me on social media:
Рекомендации по теме
Комментарии
Автор

I don't know why give this piece of gold a downvote? 🤔
He is telling Uncle Bob's story in flutter and he is doing it pretty much excellent.
Keep up the good work Reso Coder. I'm a big fan of yours.

tintin
Автор

Alll the way in from 1 to 10 videos this is the most enjoyable series i've ever seen on youtube thanks <3

asettani
Автор

I love how the Clean Architecture forces you to extract all the logic from BLoCs, making it "PLoC", haha, which leads to the most awesome separated code ever and you can use the code even without BLoC itself, and you can, for example, use Redux for your web part or whatever, because of no app logic is in BLoC.

That is a really awesome feature. Thank you so much for your work. I have just realized a ton of things from going through your videos and this series has been more helpful to me than a subject in school.

tenhobi
Автор

One rule of thumb for error handling is to never depend on a try-catch if you don't need to, and manually throwing an error that you are immediately catching is a good sign that this is the case. Instead of using int.parse, use int.tryParse, which returns null if the input isn't a valid integer instead of throwing an error. As such, the entire body of stringToUnsignedInteger code could be reduced to:

int val = int.tryParse(str);
if (val == null || val.isNegative) return Left(InvalidInputFailure());
return Right(val);

Abion
Автор

Once again a great tutorial. I am spreading the word that you are a fantastic teacher!!!

davidfox
Автор

There you go, thank you for the effort and keep on going. Best Flutter Tutorials on YouTube 🤘🤘🔥

ShadowInfest
Автор

As a heads up to future watchers, as of equatable 0.6, props is no longer implemented using a super constructor but instead as an overridable getter.

Abion
Автор

Almost there. Keep it up!
Going till the finish line!

jesselima_dev
Автор

This is a really good series and just at the right time. Thanks. Hope you've noticed that the Equatable package has changed (I think from version 0.6.1) and no longer takes properties via the constructor, instead it gets them via a getter.

gmcquads
Автор

Wow been waiting for this all day. Thanks a whole lot

christianonwe
Автор

bloc has change him structure, will be a nice help, maybe update this section, ty

juanalbertoacunasilvera
Автор

I'm curious why didn't you consider imposing the range of numbers as part of the business logic, e.g in the GetConcreteNumberTrivia usecase?

ahmedaboelyazeed
Автор

Thank you for noting that the Bloc term is not really appropriate. Should be Ploc or Application logic component

LjaDjXQKeymSDxh
Автор

@9:33 yes you do have scared me enough.. lol

piyushmehndiratta
Автор

What if I needed Map<String, dynamic> in my bloc event from multiple textfields? Or should I pass each textfield value then create a map in the datasource to use it for http post? Sorry I'm new to this clean architecture and flutter.

Shumi_Desu
Автор

+1 for "I hope that I scared you enough not to do this" Hahaha

MikeWallaceDev
Автор

Why not use the use case in the widget?

diego.coder
Автор

Anyone know how to convert the Super Constructors for the Equatable extensions to getters for the new equatable package update?

peterirving
Автор

If Dart always generates interface for classes, why did you have to create Abstract classes like you did? I don't quite understand that.

A_I_GHOST
Автор

int parse for null safety


final result = int.tryParse(str);
return result == null || result < 0
? Left(InvalidInputFailure())
: Right(result);

XmasApple