Flutter TDD Clean Architecture Course [3] - Domain Layer Refactoring

  Рет қаралды 60,802

Reso Coder

Reso Coder

Күн бұрын

Пікірлер: 85
@pathakvivek7865
@pathakvivek7865 5 жыл бұрын
Reso Coder is becoming my favorite channel for learning flutter
@ResoCoder
@ResoCoder 5 жыл бұрын
Thanks for learning here!
@TheMeanCanEHdian
@TheMeanCanEHdian 4 жыл бұрын
The jump cut at 12:31 doesn't show you changing class GetConcreteNumberTrivia implements UseCase to class GetConcreteNumberTrivia implements UseCase. If anyone gets an override error this is why.
@seviavishalom
@seviavishalom 4 жыл бұрын
Thank you!
@paulo3232
@paulo3232 4 жыл бұрын
I thought i missed something, thank you.
@A-Bellis
@A-Bellis 3 жыл бұрын
Thanks man
@lodarn911
@lodarn911 3 жыл бұрын
You are a lifesaver
@sykoz371
@sykoz371 Жыл бұрын
thanks
@JeremyConnor
@JeremyConnor 5 жыл бұрын
Thanks for the videos mate, I think you can make your UseCase class slightly more elegant using the void type (see below). abstract class UseCase { Future call(Params params); } class ExampleWithoutParams extends UseCase { @override Future call(void params) async => 42; } class ExampleWithoutReturnType extends UseCase { @override Future call(String params) async => print(params); }
@abdelrhmnallam6416
@abdelrhmnallam6416 2 жыл бұрын
thanks
@chordfunc3072
@chordfunc3072 5 жыл бұрын
10:26 wouldn't it be better to have the method signature have an optional param ([Params params]): Future call([Params params]);
@milossblagojevic
@milossblagojevic 5 жыл бұрын
Really appreciate all three TDD vids so far. This is most comprehensive series regarding TDD in Flutter. Thank you very much and keep it going
@abderrahmansettani9843
@abderrahmansettani9843 5 жыл бұрын
This series is veeery good, you are the only person i wait for his videos ! keep going bro
@habibbellia2607
@habibbellia2607 5 жыл бұрын
I am waiting this vid more then 3 days Thank you 👍👍👍
@LuisHernandez-sd8sc
@LuisHernandez-sd8sc 3 ай бұрын
Here reviewing again this great vidios for new App in 2024, ty Reso Coder
@deoneloff
@deoneloff 5 жыл бұрын
Great training video!! My flutter journey has become a lot smoother thanks to you. Many thanks!!
@ResoCoder
@ResoCoder 5 жыл бұрын
I'm glad I could help!
@user-kw9cu
@user-kw9cu 2 ай бұрын
You can use mocktail package to avoid using code generation from the latest version of mockito package.
@eduardorabanal2803
@eduardorabanal2803 5 жыл бұрын
great video again bro, i'll be waiting for the next one
@flarecodeflit4823
@flarecodeflit4823 5 жыл бұрын
you literally made everything easy to learn
@vladimirmbassi
@vladimirmbassi 5 жыл бұрын
Keep up the good work! Can't wait for the next video
@ZubairRehman
@ZubairRehman Жыл бұрын
you can use second param as void e.g. class GetRandomNumberTrivia implements UseCase {} and when you are calling your usecase then you can pass null as param e.g. GetRandomNumberTrivia(params: null)
@hellofolks5606
@hellofolks5606 4 жыл бұрын
Hey reso, why do we need Type both in the UseCase declaration and in the call return type? Can't we just have it in the function's return type?
@kherelable
@kherelable 5 жыл бұрын
HI, what is the reason to create two classes for every feature, instead of creating one service class for both of them? Is it a part of DDD methodology? p.s. thanks for the video.
@nr152522
@nr152522 5 жыл бұрын
It's a really good question and would love a response from Reso Coder. *I think*, the point is to use the underlying data to build explicit domain use cases required by the app. If you glance the app structure, the intent of the feature then becomes clear. It would also be easy to add new functionality to the feature by implementing a new use case. Wrapping everything into a service layer might not be so transparent, although IMO, it does feel more natural.
@ResoCoder
@ResoCoder 5 жыл бұрын
You want to have as much separation as possible. I agree, the example given in this Number Trivia App may not be the most fortunate one, but I wanted to keep this course as simple as possible. When you don't have just two use cases, one for random and the other for concrete trivia, and when there's some actual logic to execute, having a separate class for each use case will greatly enhance the testing process.
@ShadowInfest
@ShadowInfest 5 жыл бұрын
Finally :D thanks for the hard work :)
@eliezerben
@eliezerben Жыл бұрын
Thanks for the video. Why do we have a separate class for Params? Is it to make subclassing easy?
@Abion47
@Abion47 5 жыл бұрын
Having a NoParams class just for use cases that take no arguments and then passing an instance of NoParams as an argument of those use cases seems redundant and arbitrary, especially since you would then have to pass an instance of NoParams wherever you use those use cases in production code as well. Is there a reason you went with this approach rather than having two separate UseCase and UseCaseWithParams base classes?
@ResoCoder
@ResoCoder 5 жыл бұрын
I mean, you can create a separate base class if you want. In fact, having any base class at all is a kind of a "interface future-proofing", because with only 2 use cases and no logic in the base class, it's not really necessary to have it.
@peterthompson6909
@peterthompson6909 4 жыл бұрын
Agree @Abion47 I chose that way - love your work @resocoder :)
@eliezerben
@eliezerben Жыл бұрын
Any real world examples projects using this architecture? Would be interesting to look through how it scales for larger projects.
@НикитаКлышко
@НикитаКлышко 5 жыл бұрын
Best english speech on KZbin 👍
5 жыл бұрын
Is there any performance difference between having relative vs absolute imports or is it just aesthetics?
@bmkgokong668
@bmkgokong668 4 жыл бұрын
I suppose if someone else copies your code and uses different app name - they would not have to refactor everywhere
@ih4722
@ih4722 4 жыл бұрын
This is tough. Long live spaghetti code
@ResoCoder
@ResoCoder 4 жыл бұрын
🍝
@pedrodelacruz2369
@pedrodelacruz2369 3 жыл бұрын
Excellent, Rewaching afthe a Year
@rawnato
@rawnato Жыл бұрын
Hey man, I'm follow your tutorial because I'm a completely noob on frontend stuff! And I'm having some issues on the test part! When I test this (when(repository.newAccountRequest(any)).thenAnswer((_) async => tAccessTokenEntity);) I have in error like this (type 'Null' is not a subtype of type 'Future') do you have an idea what is happening?
@mukeshbheel3320
@mukeshbheel3320 Жыл бұрын
The problem is with the mockito pakage since any always returns a null type. Use mocktail package instead which is based on mockito and handles the null safety. make these changes in the code. import 'package:mocktail/mocktail.dart'; () async { when(() => mockNumberTriviaRepository.getConcreteNumberTrivia(any())) .thenAnswer((_) async => Right(tNumberTrivia)); verify(() => mockNumberTriviaRepository.getConcreteNumberTrivia(tNumber)); it should work.
@rawnato
@rawnato Жыл бұрын
@@mukeshbheel3320 thanks bro
@ianjaspersantos8915
@ianjaspersantos8915 4 жыл бұрын
Hello reso! Just want to ask what will be under the folder usecase?? Is it all the methods from entities and repositories must have an use case?? or is it just the repositories' methods to map into usecase classes? Thanks!
@eincandela
@eincandela 3 жыл бұрын
Best tuts i have ever followed ! Quick question: I cannot find any info on types after a class definition in dart, like UseCase. What are those for ? Thanks :)
@MKBBKD
@MKBBKD 3 жыл бұрын
This is not a types. Type and Params is a template, its like promises that when you use that class you write there some type(or classes)
@aloussase
@aloussase 5 ай бұрын
The use case interface would be neater with something like variadic template parameters for the params type
@haidarrmehsen
@haidarrmehsen 4 жыл бұрын
Excellent explanation!
@AimaneNajja
@AimaneNajja 5 жыл бұрын
the value that you return in the thenAnswer and the value that you expect actual to be equal to are not the same instance which causes the test to be red
@IdanAyalon
@IdanAyalon 5 жыл бұрын
Thank you!! amazing videos
@amanshah2654
@amanshah2654 4 жыл бұрын
can you also tell how to implement a login system with clean architecture
@karangore6969
@karangore6969 2 жыл бұрын
Damn! you are so honest with your content sharing
@alessandroburza4568
@alessandroburza4568 2 жыл бұрын
the class Params inside the usecase, if I have multiple usecases should I name it like GetConcreteNumberTriviaParams or something? or always Params
@mehdiparsaei1867
@mehdiparsaei1867 3 жыл бұрын
Thanks for useful contents!
@mohammadrezaraeesy4626
@mohammadrezaraeesy4626 3 жыл бұрын
it s good tutorial for tdd . I love it
@dawidniegrebecki2205
@dawidniegrebecki2205 4 жыл бұрын
Great Video!!
@hathanhnguyen555
@hathanhnguyen555 3 жыл бұрын
Thanks a lot for your tutorials. I love you
@alaasayed6508
@alaasayed6508 2 жыл бұрын
are u working with null-safety
@hathanhnguyen555
@hathanhnguyen555 2 жыл бұрын
@@alaasayed6508 Yes
@TheFlyingMonkey200
@TheFlyingMonkey200 3 жыл бұрын
Where do we put the presentation logic for the code. Lets say for example we need to interact with an IOS sdk on the iphone and need that to update the UI in some way.
@MichaelDev
@MichaelDev 4 жыл бұрын
Please , check link tutorial... just link tutorial 3 clean arq... is error ,not found please fix ...
@memosen80
@memosen80 2 жыл бұрын
What if Params has to send multiple variables? How do u make Params so called generic when u need to pass let’s say email and password ?
@nasirbalochtv
@nasirbalochtv 10 ай бұрын
class LoginParams { final String email; final String password; LoginParams({required this.email, required this.password}); }
@max_ishere
@max_ishere 2 жыл бұрын
Arent usecases the same as closures then?
@1995taunus
@1995taunus 5 жыл бұрын
Thank you for your videos! Why relative Imports are better than absolute Imports?
@ResoCoder
@ResoCoder 5 жыл бұрын
I just like them.
@1995taunus
@1995taunus 5 жыл бұрын
Thank you for your Videos! As gratitude for your work I would like to do something good for you: order pizza, donate (please add your version).
@ResoCoder
@ResoCoder 5 жыл бұрын
@@1995taunus Thank you! I would very much appreciate a your donation. Here's a link www.buymeacoffee.com/resocoder
@liorpolak1391
@liorpolak1391 2 жыл бұрын
Very good
@rezaasgary1442
@rezaasgary1442 4 жыл бұрын
is it available for android studio i mean dart import?
@laujimmy8635
@laujimmy8635 4 жыл бұрын
How do you know what should be tested or not ?
@BiniyamAlemu-rb4tt
@BiniyamAlemu-rb4tt Жыл бұрын
Hey could you update this project using current fluttter version
@aloussase
@aloussase 5 ай бұрын
I wouldnt have created an interface for use cases because no one is really benefiting from that and it makes the code uglier because the different use cases are sufficiently different to make it awkward to use the same interface. Otherwise great video!
@shivanshiverma8025
@shivanshiverma8025 4 жыл бұрын
I want to construct a method in abstract class( in the domain layer ), and I want to pass the Buildcontext as a parameter. Will doing this violate the principles of clean architecture? #ResoCoder
@svetozarvolkov5953
@svetozarvolkov5953 4 жыл бұрын
Yes, it will. presentation layer can depend on domain layer but not vice versa. See "Dependency Rule" at blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
@aminelahrim8142
@aminelahrim8142 3 жыл бұрын
Why so much boiler code. In this tuto like creating a full class for only one futures what if. You have 40 get... You will create lot of folder and sub folder and classes why you didn't create class with lots of functions that do the work.
@fclinuxnova7977
@fclinuxnova7977 4 жыл бұрын
could you please share the source code, I cannot understand what your mind are concern on each line of code or this is just able to be refereed by experience user, thanks
@hrushipatil
@hrushipatil 4 жыл бұрын
Where can i get the aaa snippet?
@sunnychan3022
@sunnychan3022 4 жыл бұрын
I have written the snippet since I cannot find one. Happy Coding. gist.github.com/SunnySs/482c8d6770909b73f7f76428e21c46f1#file-dart-json
@opimand
@opimand 3 жыл бұрын
../../SDK/flutter/packages/flutter_test/lib/src/window.dart:6:8: Error: Not found: 'dart:ui' import 'dart:ui' as ui hide window; Android Studio
@akshaymankodia9003
@akshaymankodia9003 4 жыл бұрын
The moment you type : super[] , dart analyser getting terminated and then we need to restart it . lol!!!
@ericsan1561
@ericsan1561 2 жыл бұрын
So much boilerplate codes. This is violating “Clean code” principle.
@jesselima_dev
@jesselima_dev 4 жыл бұрын
Done! ehehehe
@manazil-5104
@manazil-5104 2 жыл бұрын
12:00
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 17 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 275 #shorts
00:29
I Asked GPT-4 To Refactor My Legacy Codebase
12:39
Nick Chapsas
Рет қаралды 349 М.
Test-Driven Development // Fun TDD Introduction with JavaScript
12:55
Flutter TDD Clean Architecture Course [2] - Entities & Use Cases
40:23
Bloc Library - Painless State Management for Flutter
24:54
Reso Coder
Рет қаралды 92 М.
The First Step To Clean Architecture | Flutter SOLID Principles
28:27
Rivaan Ranawat
Рет қаралды 18 М.
Understand Clean Architecture in 7 Minutes
7:02
Amichai Mantinband
Рет қаралды 112 М.
Flutter Clean Architecture
19:58
HeyFlutter․com
Рет қаралды 25 М.
Flutter BLoC Pattern Tutorial From Scratch
20:51
Reso Coder
Рет қаралды 349 М.
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 17 МЛН