Flutter TDD Clean Architecture Course [2] – Entities & Use Cases

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

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

In the first part, you learned the core concepts of clean architecture as it pertains to Flutter. We also created a bunch of empty folders for the presentation, domain and data layers inside the Number Trivia App we're building. Now it's time to start filling those empty folders with code, using TDD, of course.

Whenever you are building an app with a UI, you should design the UI and UX first. I've done this homework for you and the app was showcased in the previous part.

The actual coding process will happen from the inner, most stable layers of the architecture outwards. This means we'll first implement the domain layer starting with the Entity.

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

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

TAKE NOTE!


For people that just started now, the latest equatable requires you to use props rather than super constructors. So,


Rather than this:-


class NumberTrivia extends Equatable {
final String text;
final int number;

NumberTrivia({
@required this.number,
@required this.text
}) : super([number, text]);
} //WRONG


Do this:-


class NumberTrivia extends Equatable {
final String text;
final int number;

NumberTrivia({
@required this.number,
@required this.text
});

@override
List<Object> get props => [text, number];

}


Peace!

ryftus
Автор

7:30 equatable: ^1.0.1
Use
@override
List<Object> get props => [text, number];
instead of : super([text, number])

muikrizalit
Автор

I'm coding for years as a hobby but you know.. never did anything in any professional manner but I always wanted to get better... and I have to say that until now it was difficult for me to comprehend the process of TDD and how to design a software in a professional or efficient way, or for the least part how to keep solid and clean code. Just from watching this video several Lego blocks connected in my head so thank you so much! And I cant wait to go through this course !!

David-rcnm
Автор

domain/entities/number_trivia > 3:50 --> JSON
core/error/failures > 12:30 --> abstract class
> 15:50 --> abstract class
test > 20:30
> 22:30 --> mockito
> 26:20
run program > 36:50

matiasgomez
Автор

I really appreciate this tutorial so far because it's language agnostic. My struggle with coding has been less about understanding a particular language/dialect (they all say/do the same things, just in slightly different ways) and more about knowing how to structure a code base, where to put the files, how those files relate to each other, what to name them, when to write them (and why).


This course is an architectural blueprint I can follow in any project in any stack. That way I'm not reinventing the wheel for every project I do and I'll get a lot of practice repeating these patterns, which means that over time I'll get faster at creating new projects.


Thank you!

scottb
Автор

It took me 5 iterations and 2 months to understand what you are doing :) thanks Matt !

bascelik
Автор

Excellent video course, the form of how you explain the things and the way of how the video was created is awesome. Thank you very much for share your knowledge with us, after watch this video I think that this is the architecture that I go to implement in my future projects, TDD + Clean Architecture + Bloc, it is simply a jewel.

alfonsoisraelosorioavilez
Автор

The Best flutter course Ive found, just keep posting, you've got followers. Keep waiting for your videos.

fridakalos
Автор

Your videos are amazing. Your clean language and dedication to teaching are very impressive to me. Thank you for sharing your knowledge with us.

fredericowebmaster
Автор

We need an update for Null-Safety, at least just a written one for the tests part. The production code is easy enough to adapt but I find it very difficult to adapt the tests. Mockito has documented solutions to the issue but given this is my very first foray into TDD, all I read is mumbo-jumbo...

Being specific, the IDE shrieks at me when using "any" as an argument matcher. I have no idea how to make this pass null-safety.

cnawico
Автор

Pls update the course to Null Safety :)

luizmoraes
Автор

Your teaching directly hit to heart bcz you make explanation as simple as possible
.... And its Feels good i appreciate it!💯

dsyaniketnemade
Автор

update

for you test to work:
1.remove this line:
class MockNumberTriviaRepository extends Mock implements NumberTriviaRepository {}

2.and annotate Main method with this:
@GenerateMocks([NumberTriviaRepository]), PS. you need to import mockito/annotations.dart

3. go to terminal and run this command:
flutter pub run build_runner build

4. import the new generated class. (MockNumberTriviaRepository)
5. done.

husseinqabalan
Автор

20:00 - Currenty if you right click the file that you want to write test and select go to test option, it will ask do you want create that file with same folder structure. Easy peasy :)

mdikcinar
Автор

This guy deserves be (very well) paid by Google.

programan
Автор

This is the snippet for aaa test:

"Arrange Act Assert test": {
"prefix": "aaatest",
"body": [
"test(",
" 'should ${1}', ",
" () async {",
" // arrange",
"",
" // act",
"",
" // assert",
" }, ",
");"
],
"description": "Arrange Act Assert test"
},

ikram-hasan
Автор

This is what I looking for.
Somehow senior programmer always told to me that we need to do TDD process when we code clean architecture.
Unfortunately, I don't understand what the TDD is .
In my desperate situation, I tried to find out TDD on youtube.
And I found it, very good dude, love your video 👍👍

yanuaryusufadika
Автор

Thank you for this course! I'll base over this arquitecture for some future personal projects using Flutter.

matheussoaressilveira
Автор

Amazing tutorials, not just beginner stuff and always the same, everything is well structure and you deeply thought about what to tell and show! Relaxing voice, perfect speed and Linux haha. Keep up that good work!!

ShadowInfest
Автор

For those who are using Android Studio or IntelliJ as development environment, refer to this medium post for running tests. Select as file instead of widget_test as it's mentioned in the post.

sametsahin