Flutter Clean Architecture - Learn By A Project | Full Beginner's Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

ความคิดเห็น • 313

  • @flutterguys
    @flutterguys  9 หลายเดือนก่อน +3

    🌐 JOIN TO TELEGRAM COMMUNITY
    🔗 t.me/flutterguysgp

  • @donathmm3881
    @donathmm3881 ปีที่แล้ว +62

    You are talking so fast man take a breath between each sentence ...

    • @arnob_
      @arnob_ ปีที่แล้ว +10

      Ya it feels like AI voiceover at 1.15x speed

    • @JJ-to7hj
      @JJ-to7hj ปีที่แล้ว +10

      Most definitely AI voice

    • @user-tf4cd2rw3t
      @user-tf4cd2rw3t ปีที่แล้ว +3

      I used the 0.75x setting :D

    • @sanjoydey2256
      @sanjoydey2256 ปีที่แล้ว +1

      Its his credit, you can slow the video speed.

    • @badsanta7356
      @badsanta7356 ปีที่แล้ว +3

      This channel is from France. No way this is his real voice

  • @DRKDQL
    @DRKDQL ปีที่แล้ว +3

    Hey guys, just wanted to ask if the data from two different features can interact with each other?
    Im making my first app and similar to your news example, I want a Songs list and a Chords list. All data will be fetched from a local DB (one Songs table, one Chords table). Each entity/model contains a list of chords (List of entity/model). So if I wanted to edit a chord, the change needs to be reflected in each entity/model.
    So I'm a bit confused as to how I can achieve this.
    Great video btw!

    • @flutterguys
      @flutterguys  ปีที่แล้ว +2

      There is no problem, you are defining two separate entities. When you edit the chord, I don't think you need to edit the song as well!

    • @DRKDQL
      @DRKDQL ปีที่แล้ว

      @@flutterguys Appreciate the response!
      Yeah was more so a confusion on how each feature has to have the architectural folders. In that way, how can one feature access data from another? I have decided to use feature folders within the architectural folders for now. Will see how it goes.
      Thanks heaps!

  • @appDev-m2l
    @appDev-m2l 11 หลายเดือนก่อน

    can u please make vedio little slow

  • @GalabPokharel
    @GalabPokharel 10 หลายเดือนก่อน +8

    Nice video but you should not have done those explicit correction on generated file in minutes 28:00 , there was a work around. I believe that was missed in this video.
    It is as follows:
    since the response from api is not a json array but json object; we need to parse that json object.
    This can be achieved by following three simple steps in their respective file:
    Step no 1: In article.dart file inside folder models
    ########
    add another class named ArticleResponseModel like below and ArticleModel as before:
    class ArticleResponseModel {
    List articles;
    ArticleResponseModel({required this.articles});
    factory ArticleResponseModel.fromJson(Map articleResponseData) {
    return ArticleResponseModel(
    articles: ((articleResponseData['articles'] ?? []) as List)
    .map((dynamic article) => ArticleModel.fromJson(article))
    .toList());
    }
    }
    class ArticleModel extends ArticleEntity {
    const ArticleModel({
    int? id,
    String? author,
    String? title,
    String? description,
    String? url,
    String? urlToImage,
    String? publishedAt,
    String? content,
    }) : super(
    id: id,
    author: author,
    title: title,
    description: description,
    url: url,
    urlToImage: urlToImage,
    publishedAt: publishedAt,
    content: content,
    );
    factory ArticleModel.fromJson(Map articleModelData) {
    return ArticleModel(
    author: articleModelData['author'] ?? "",
    title: articleModelData['title'] ?? "",
    description: articleModelData['description'] ?? "",
    url: articleModelData['url'] ?? "",
    urlToImage: articleModelData['urlToImage'] ?? "",
    publishedAt: articleModelData['publishedAt'] ?? "",
    content: articleModelData['content'] ?? "",
    );
    }
    }
    Step no 2: And news_api_service.dart, new get method function looks like below
    ########
    @GET('/top-headlines')
    Future getNewsArticles({
    @Query("apiKey") String ? apiKey,
    @Query("country") String ? country,
    @Query("category") String ? category,
    });
    Step no 3: Change ArticleRepositoryImpl as below:
    ########
    class ArticleRepositoryImpl implements ArticleRepository {
    final NewsApiService _newsApiService;
    ArticleRepositoryImpl(this._newsApiService);
    @override
    Future getNewsArticle() async {
    try {
    final httpResponse = await _newsApiService.getNewsArticles(
    apiKey: newsAPIKey, country: countryQuery, category: categoryQuery);
    if (httpResponse.response.statusCode == HttpStatus.ok) {
    // here you need to return httpResponse.data.articles instead of httpResponse.data
    return DataSuccess(httpResponse.data.articles);
    } else {
    return DataFailed(DioError(
    error: httpResponse.response.statusMessage,
    response: httpResponse.response,
    type: DioErrorType.badResponse,
    requestOptions: httpResponse.response.requestOptions));
    }
    } on DioError catch (err) {
    return DataFailed(err);
    }
    }
    }
    easy peasy lemon squeezy

  • @adrianbilescu
    @adrianbilescu 9 หลายเดือนก่อน +3

    I'm not a fan of feature folders... I had a better experience with having the layers a the first folders. Afterward, if the project needs to be broken in modules, I would add for each module a layer structure.
    Important is to acknowledge that simple apps don't need that many layers and sometimes can overcomplicate a simple 3 feature app.
    The use case is pointless in this example and can be easily pointed out as overengineering. Use the repository directly as use cases and you will have a simpler design. You have the same flexibility, or even bigger. Less code > More code.

  • @MrAmG17
    @MrAmG17 ปีที่แล้ว +2

    The most stupid thing was that you modified generated file 28:30... NEVER modify generated files!

  • @jackvessalius7913
    @jackvessalius7913 11 หลายเดือนก่อน +9

    @flutterguys in 28:32 you manually edit the ".g.dart" file, what happen if i re-run "flutter pub run build_runner" again?will the manual modification gets replace by generated code again?

    • @BhardwajHackology
      @BhardwajHackology 13 วันที่ผ่านมา

      yes running the command will reset the manually changed lines of code, you will have to redo it

  • @sarawanak
    @sarawanak ปีที่แล้ว +11

    Go to video for one who wants to learn Clean Architecture with a real world example. Definitely a good watch & bookmark for me for Future references. Thanks a lot for the valuable content. I had to pause and watch to understand, the content is very intense.

  • @nunodiogosilva
    @nunodiogosilva ปีที่แล้ว +16

    Great video! Well explained and following KISS principle.
    I would love to get more in depth videos and something that is not quite out there yet (at least an updated version), something like an authentication feature using OAuth or Firebase Auth alongside a simple routing system that redirects you the right presentation page depending if you are signed in or not in the meanwhile taking advantage of deep link. I think this makes a lot of sense since we are using a Clean Architecture approach to Flutter, in this way we may create an App that is multi-platform compatible and highly scalable and maintainable.

  • @ulmasbekrakhmatullaev8808
    @ulmasbekrakhmatullaev8808 ปีที่แล้ว +2

    Why are you changing the generated model files 28:20, doesn't it contradict what you are preaching? Does not look clean to me.

  • @muhammadfarooqzahid
    @muhammadfarooqzahid หลายเดือนก่อน +1

    Clean Architecture isn't clean though 😀.

  • @LeeVaughn-j7u
    @LeeVaughn-j7u ปีที่แล้ว +4

    If you have multiple features for an app, would you not want to put the app database class and its generated floor code in the core package? Having it in the news feature package would make sense if that feature was going to be standalone module but Im not familiar with how that works in flutter and Im assuming thats not the case here.

  • @mohammadrezabehzadfar8122
    @mohammadrezabehzadfar8122 ปีที่แล้ว +4

    thanks for nice video i just want to mention one thing it is not good idea to edit generated file (.g file) to solve that parse issue problem it is better to handle it by our own and change Future to Future and in article_repository_imp.dart parse it like this :
    List articles =
    (httpResponse.data['articles'] as List)
    .map((e) => ArticleModel.fromJson(e))
    .toList();

    • @flutterguys
      @flutterguys  ปีที่แล้ว +1

      Thanks for sharing

    • @mustafaaksoy7897
      @mustafaaksoy7897 ปีที่แล้ว

      Wow clever idea, you should also make videos.

  • @irvingprojectdev
    @irvingprojectdev ปีที่แล้ว +3

    Great tutorial bro. Sory but I got a problem when get imageUrl _TypeError (Null check operator used on a null value) in article_tile.dart
    would you help this error, thanks

    • @dtechb
      @dtechb ปีที่แล้ว +1

      Confirm if you passed urlToImage in ArticleModel class to super

  • @happycat6836
    @happycat6836 8 หลายเดือนก่อน +2

    i encounter a problem took me few hours to figure it out, ArticleModel constructor name params should be super.title, if it is String ? title, all ArticleModel we get from factory, their attibute all Null

    • @emohamed7489
      @emohamed7489 2 หลายเดือนก่อน

      Thank you man I was having this problem

  •  7 หลายเดือนก่อน +1

    I want to stay with you... but man, slow down...

  • @minseokjeong1881
    @minseokjeong1881 ปีที่แล้ว +6

    Recently I'm thought about what is good architecture for flutter project. And I met this channel and this Clean Architecture is blowing my mind. This video has concrete example so I can learn the folder structure and concepts of clean architecture. Thanks you from bottom of my hearts❤. From S.Korea as Flutter position developer.

  • @ArturoMartinez-uz5sw
    @ArturoMartinez-uz5sw ปีที่แล้ว +1

    its better have data/domain/presentation as main layers, and then add by module like data/auth/..., that repeat on each feature all the auth/domain/data... layers, having many directories make it complex to read.. simple its better always

  • @Wilson_Merpati_Jaya
    @Wilson_Merpati_Jaya ปีที่แล้ว +3

    great tutorial. in minutes 28:00 i tried my code and got I/flutter null. please advice. thanks

    • @jemjem8902
      @jemjem8902 8 หลายเดือนก่อน

      Same, did you fix it?

    • @jemjem8902
      @jemjem8902 8 หลายเดือนก่อน

      I tried logging the data I get from the API, it's null. When I try it in postman, like same query params, it works

  • @alexandergoldenberg8915
    @alexandergoldenberg8915 ปีที่แล้ว +1

    i liked video until 28:27 very good explanation on why doing something , but error fixing in 28:27 destroyed all impression, how you can fix something in code where on top even comment don't do it manually its generated code, no one can remember all manual fixes , after adding net call api you will generate code again and this manual fix will be deleted and you will not understood why application stoped to work.If it possible can you present how to fix it so next generate will not delete it, thanks

    • @flutterguys
      @flutterguys  ปีที่แล้ว

      I didn't find a solution from the retrofit document and I didn't want to make an additional model....
      I did not expect the video to go viral 😂

  • @mehedihasanhridoy1701
    @mehedihasanhridoy1701 หลายเดือนก่อน +1

    This video makes me feel that I don't know nothing.

    • @flutterguys
      @flutterguys  หลายเดือนก่อน

      Welcome to programming

  • @finikkkk
    @finikkkk 4 หลายเดือนก่อน +1

    Such a small application, and so much code, so much time spent! But what if the app is much bigger than that? 😬😑

  • @tavindersingh8185
    @tavindersingh8185 7 หลายเดือนก่อน +1

    Updating news_api_service.g.dart directly @28:35 was not a great idea because if the build runner command is executed again then those changes will be reset. For your scenario this is fine but you should consider that lots of beginners are watching this tutorial and they will implement these techniques in there next project.

  • @mehediehteshum3741
    @mehediehteshum3741 4 หลายเดือนก่อน

    Great video! Thanks for the content...
    I have one confusion...
    Could @flutterguys or someone please explain this to me?... Since the presentation layer (bloc, state, widgets, etc.) and the data layer repo implementation (for saving articles locally) depend on the ArticleEntity (the domain entity), then how does this clean architecture make layers independent from each other or at least the domain layer decoupled from the other layers? TIA

  • @hyefur
    @hyefur หลายเดือนก่อน

    Great video! I’ve learnt a lot to be honest. But is there a plugin available to simplify creating boilerplate codes for entities and models. Feel writing those can be cumbersome.

  • @McLouQ
    @McLouQ ปีที่แล้ว +4

    Hello, many thanks for content! Any recomendation how to pass different combinations of query parameter/s, header/s and body to use cases? First API endpoint (use case) requires Id(query) and entity(body), second endpoint requires Id(query) and userId(header) for example. Should I create special params entity for all use case inputs?

    • @IINOCON
      @IINOCON 11 หลายเดือนก่อน

      This worries me a lot too. Have you found the answer to the question?

  • @runthere100
    @runthere100 ปีที่แล้ว +2

    if you having an issue at 14:17 like
    "Failed to build build_runner:build_runner: ~~~~~ final error = e[0] as Object? ?? NullThrownError();"
    you should go to terminal agin, write;
    flutter pub upgrade
    flutter pub outdated
    flutter pub upgrade --major-version
    flutter pub get
    then you can try again to continue;
    flutter pub run build_runner build
    (': sorry if im mistaken , some code may be unnessecery but in total, that's works for now :')

  • @azimzadehM
    @azimzadehM หลายเดือนก่อน

    Hello, the video content is nice but old, we would appreciate it if you create a new one for today's version. Thanks

  • @pmpjim
    @pmpjim ปีที่แล้ว +1

    It's not really clean, the folder structure actually makes me confused :), but it's still a great video, thanks for sharing!

  • @hiskel_kelemework
    @hiskel_kelemework ปีที่แล้ว +2

    great video! one question, is it safe updating generated files by hand ? what happens when you rerun the build command ? will your manual updates not be overriden ?

    • @HashemRC
      @HashemRC ปีที่แล้ว +1

      You should not modify generated files, as they will be overwritten next time with the build runner called.

  • @lalitmujalde3072
    @lalitmujalde3072 8 หลายเดือนก่อน +1

    I'm getting the exception in the "article!urltoimage!" in the article_tile.dart file as -> "no host specified in the URL ". how to resolve this??

  • @blumiden
    @blumiden 7 หลายเดือนก่อน

    I honestly hate developers who try to do "clever" shit or put a bunch of logic all into one line until you can't read it, or add so many unnecessary layers for "just in case" shit there's little chance of ever being used, etc. They're usually the same people who bounce jobs every couple years so they never have to support any of the trash they write.

  • @hi-dq4sh
    @hi-dq4sh 8 หลายเดือนก่อน

    Brother, its too fast for beginners. You can upload a little bit slower videos, for everyone. And the ones who want it quicker can increase speed.
    It doesn't sound good when speed decreased but fine when speeed increase.

  • @sinazp8422
    @sinazp8422 10 หลายเดือนก่อน +2

    hi, after searching whole internet i found this wonderful tutorial about clean architecture, but i am little confuse about the difference of mvvm, mvc and mvi architecture vs clean architecture, somewhere in stackoverflow i read that mvvm and.... only use in presentation layer and we can use them even in clean architecture , so here in this project what kind of architecture are you using in presentation layer? and can you explain about it? thank you ❤

    • @shipooprincess670
      @shipooprincess670 7 หลายเดือนก่อน

      MVVM solves issues from MVC.
      MVVM structure follows clean architecture.

  • @NHCH
    @NHCH 3 หลายเดือนก่อน +1

    watch out at 12:50, it is not a good practice to hop out of the folders using the ../../ syntax, in Dart you should use the package: notation

    • @DhafinRayhan
      @DhafinRayhan 3 หลายเดือนก่อน

      Who said that? If you look at Effective Dart: Usage, you'll see that it tells you to PREFER relative import paths

    • @NHCH
      @NHCH 3 หลายเดือนก่อน

      @@DhafinRayhan PREFER == best practice
      i didn't say it won't work, i said it's a best practice.

    • @DhafinRayhan
      @DhafinRayhan 3 หลายเดือนก่อน

      @@NHCH But you literally said the opposite. You claimed that using relative imports is not a good practice. Where's the reference? What is the basis of your claim?

  • @dgodiegomartins
    @dgodiegomartins ปีที่แล้ว +1

    Tks, great content, i've learned a lot with your videos.
    Just one point. I dont like to my domain depend on dio package. Dio is a infrastructure concern

  • @lesptitsoiseaux
    @lesptitsoiseaux 9 หลายเดือนก่อน

    The temerity of calling this a 'beginner' video 😅 Stop flexing...

  • @timurakhtyamov3364
    @timurakhtyamov3364 ปีที่แล้ว +6

    Very nice and complete explanation, thanks a lot! Looking forward for similar videos on other topics!

  • @frankcastle3288
    @frankcastle3288 หลายเดือนก่อน

    I guess this is why people don’t like OOP anymore

  • @leofrancis2685
    @leofrancis2685 ปีที่แล้ว +1

    do we really need usecases why cant we use repositories instead of usecases directly.

    • @NHCH
      @NHCH 3 หลายเดือนก่อน

      what if tomorrow you need to add a repository/change the current one?

  • @DyecksRF
    @DyecksRF ปีที่แล้ว +1

    Please put subtitles on your videos. Today with AIs it is so simple and easy! This way, people from all over the world can see your videos.

  • @david_junior
    @david_junior 7 หลายเดือนก่อน +4

    It is so helpful that you show the errors you encounter and how to solve them.
    Makes a big difference, thanks.

  • @timurnugaev1003
    @timurnugaev1003 6 หลายเดือนก่อน +1

    bro used retrofit and then changed the generated file 💀

    • @ihard_k
      @ihard_k 3 หลายเดือนก่อน

      He didn't, he imported in where part is written

  • @willgriner8965
    @willgriner8965 8 หลายเดือนก่อน

    wtf is going on at 3:15 and 5:27 ?? Why does he essentially do the same thing twice? I think the first one is just an example?

  • @farahfrija6863
    @farahfrija6863 7 หลายเดือนก่อน +1

    hello ! is there any extention to give a folder icon like in the case of your vs thank you

  • @AshishPatel1992
    @AshishPatel1992 ปีที่แล้ว +3

    Amazing video! But few concepts goes beyond my head. Can you provide few learning resources that I can use to follow to have better understanding of the architecture. I would appreciate your headsup on this! :)

    • @flutterguys
      @flutterguys  ปีที่แล้ว

      Search on Github or Medium

  • @emwagner
    @emwagner ปีที่แล้ว +1

    When I have written in MVC, I've usually had another project called Domain.Shared as well as Domain. Is this a good idea for a Flutter project? What about class inheritance? As an example. A BaseEntity to hold/contain shared properties between entity classes?

  • @ghulammurtaza7959
    @ghulammurtaza7959 ปีที่แล้ว +6

    This series is awesome ❤

  • @relaxx717
    @relaxx717 ปีที่แล้ว +1

    I don't know why but for me it looks a bit hard even if I learn Flutter for 1 year..

    • @flutterguys
      @flutterguys  ปีที่แล้ว +3

      1 year is not long , You need practice and check source codes.

  • @kenoisplaying5279
    @kenoisplaying5279 8 หลายเดือนก่อน +1

    I don't know if this is a good approach for big projects I mean in the example you have it is a small app and you have a huge folder structure what would happen with medium-big projects?

    • @blumiden
      @blumiden 7 หลายเดือนก่อน

      I feal like that this approach is not following the KISS principle, because of many introduced shallow "modules", just passing the data

    • @RezaElborneo
      @RezaElborneo 21 วันที่ผ่านมา

      I believe that having many developers involved in a large-scale project would make it even better. It helps keep the code/context modular for each developer. While it may lead to an increase in the number of folders and files, navigating through it could be a challenge. However, modern IDEs make it easier by allowing for compilation error detection that pinpoint the exact files and lines causing the issue.

  • @rifkiardiansyah616
    @rifkiardiansyah616 7 หลายเดือนก่อน

    Confused unga bunga

  • @mrkesu
    @mrkesu 5 หลายเดือนก่อน +1

    Great video, exactly what I needed to start this new "clean code" journey and also thanks for providing a link to that three-part series of articles in the description. I definitely need to follow up by reading them too since I struggled a bit with following the fast paced monotone computer generated voice.

  • @afadl12121
    @afadl12121 5 หลายเดือนก่อน

    Thank guys, Here is a question where is the part that ArticleModel transformed to ArticleEntity, i mean how ?

    • @flutterguys
      @flutterguys  5 หลายเดือนก่อน +1

      By using extend , Please check source code

  • @dgofurjanov
    @dgofurjanov 5 หลายเดือนก่อน

    in 2024, I got a bunch of errors due to dependencies mismatching versions. When I downgraded, I got similar results as it was shown. I am new to flutter. I found this tutorial helpful. But those errors were disappointing. Please, Dear Author, update some fixes. Thank you, anyway❤.

  • @adianblabla
    @adianblabla 10 หลายเดือนก่อน

    I think it's a bad arhitecture to have different blocs for remote/local. IMO you should have the remote/local repositories which are interchangable, based on network connection.
    It more simple/clean/maintable and reduce the boilerplate comes with having diffeent blocs for remote/local.

  • @martinmajewski
    @martinmajewski 7 หลายเดือนก่อน

    Putting the abstract "usecase" class file into the core folder seems arbitrary. It is an essential part of the domain layer and should be located there, next to the use case implementations. When you put it into "core," you have a hard link between the domain and core layer, which makes the domain layer not independent of the other layers!

  • @SixGraphics
    @SixGraphics ปีที่แล้ว

    Your talking faster, as you talk with pro not beginners, just upload Normal video playback

  • @oaiwjebdlla
    @oaiwjebdlla 4 หลายเดือนก่อน

    Hey, why ingredient model doesn't pass parameters to super class? Thanks

  • @PrateekAher
    @PrateekAher 9 หลายเดือนก่อน

    None of the statements in initializeDependencies() method are asynchronous. Why is the function itself asynchronous?

  • @omkarp9943
    @omkarp9943 ปีที่แล้ว

    At first, I thought the video was playing at 1.5x speed😐
    Btw...thanks for this video!!

  • @arturfilar905
    @arturfilar905 11 หลายเดือนก่อน

    In Create Repository Classes and Models video you make the Data model extend the Domain Entity which creates a dependency on Domain Layer from Data layer. Isn't it an antipattern? Well maybe it's not, since the Data layer should be swappable and the Domain layer contains only bussiness logic that should not have any frameworks and specific implementations/technologies.

  • @the_akash_khandagale
    @the_akash_khandagale ปีที่แล้ว +2

    very crisp & clear explanation .. Just wanted to ask can we use the bloc's cubit instead of old bloc state management method

    • @onyemaanthony
      @onyemaanthony ปีที่แล้ว +2

      yes you can use any state management of your choice

    • @ka61er
      @ka61er ปีที่แล้ว

      @@onyemaanthony can i ask you ? which is the best for state management right now ?

    • @onyemaanthony
      @onyemaanthony ปีที่แล้ว +1

      Well there is nothing as best state management it depends on the project your working on and also a lot of use cases I will say as a flutter developer make sure your confortable working with bloc and provider as the are the most popular in the community

  • @syedibrahim1361
    @syedibrahim1361 7 หลายเดือนก่อน

    Hi I have one question why repo abstraction is in domain layer why it is not in data layer? can you please explain in comment.

  • @kapilpoudel8452
    @kapilpoudel8452 10 หลายเดือนก่อน

    Too fast for begineer so great video but will back later after become good at flutter !! make a medium pace videos so that it would be beginner friendly too !

  • @avinashsudhanshu
    @avinashsudhanshu 11 หลายเดือนก่อน +1

    DioError is deprecated.

  • @HarshAgrawal-u2o
    @HarshAgrawal-u2o 2 หลายเดือนก่อน

    at 28:40 my app is stuck in RemoteArticleLoading state and not proceeding into done or failed

    • @UsmanKhan-xu8kn
      @UsmanKhan-xu8kn 2 วันที่ผ่านมา

      try to print the state in the bloc, your list must be empty, so it will not be going to the if block, therefore not emitting the Done state.

  • @ranjankiran2269
    @ranjankiran2269 ปีที่แล้ว +1

    Hey really nice video 👍, i had one question, so what if two different features share the same state, like they depend on a reactive state, where would you put it? Should it be in the data section but it won't be from a data source but just some shared state, how do you handle this.

    • @flutterguys
      @flutterguys  ปีที่แล้ว

      If you can give an example

    • @ranjankiran2269
      @ranjankiran2269 ปีที่แล้ว +1

      we have two pages, and on one page we have a switch, and the other page will show some text based on the current value of the switch on the other page. we have two pages each with their own application login, but this switch is one that is shared.

  • @CharlesSteinmetz1
    @CharlesSteinmetz1 ปีที่แล้ว +2

    Very good content, thank you! I would have a question regarding entities and models.. isn't there an easier way of doing that without writing a model that looks almost the same as the entity besides the annotations? It looks like a lot of duplicated work especially when changing the entities/modes...

    • @flutterguys
      @flutterguys  ปีที่แล้ว +3

      You can delete the entity, but this is against the clean architecture, on the other hand, because the entity is in the domain layer and the domain layer is independent and should not be subject to external changes. We cannot use entity in the data layer because we may make changes in the database or api at any moment, which will lead to changes in the entity and domain layer, which is contrary to clean architecture.

    • @elijahonduso
      @elijahonduso ปีที่แล้ว +7

      @@flutterguys Still this explanation isn't quite clear because ArticleModel is extending the ArticleEntity. What does this mean if for some reasons, we change the articlesModel to add or remove or modify fields? We'll be forced to also update the entity. Instead of extending, I prefer separate data mappers for this. What do you think?

    • @devisagosto
      @devisagosto 10 หลายเดือนก่อน

      @flutterguys can you reply please? I'm interested

  • @herlambangkurniawan6027
    @herlambangkurniawan6027 ปีที่แล้ว +1

    I got this error at 12:50 "The type 'HttpResponse' is declared with 0 type parameters, but 1 type arguments were given.Try adjusting the number of type arguments to match the number of type parameters."
    Anyone know how to solve it ?

    • @flutterguys
      @flutterguys  ปีที่แล้ว

      Check source code.

    • @herlambangkurniawan6027
      @herlambangkurniawan6027 ปีที่แล้ว

      @@flutterguys Thanks for your reply and by the way I have already solve this problem a few days ago 😁😁

    • @umitylmaz6481
      @umitylmaz6481 ปีที่แล้ว

      @@herlambangkurniawan6027 how you solved this error?

    • @jorgeflorescarlos8537
      @jorgeflorescarlos8537 11 หลายเดือนก่อน

      @@herlambangkurniawan6027 How did you solve it?

    • @naveennirban
      @naveennirban 11 หลายเดือนก่อน

      @@jorgeflorescarlos8537Import HttpResponse from dio instead of dart:io

  • @Adrian_kal
    @Adrian_kal ปีที่แล้ว +6

    The summary: we need to write hundreds of lines of boilerplate because otherwise it's against the rules of clean architecture.
    Remember that each line you write needs to be computed. The less code, the faster is your app, the more maintainable it is etc.
    You don't need classes for success and failure when you just can use Either from fpdart, you dont need entity and model if you can use freezed to do all of it. You don't need half of clean architecture when you can use retrofit. You don't need the second half when you use riverpod. Let those libraries generate boilerplate for you. They output optimized and tested code so you don't need to worry about performance too much.

    • @hitesh2293
      @hitesh2293 ปีที่แล้ว

      So what do you think is the right way? Would like to hear your thoughts

    • @mac.ignacio
      @mac.ignacio ปีที่แล้ว

      I have a trust issue with libraries so I will make my own retrofit, riverpod or bloc. It is better for me to write it than trusting someone in the internet to trust another human being codes.

    • @jackvessalius7913
      @jackvessalius7913 11 หลายเดือนก่อน

      ​@@mac.ignacioif you come from react native, this thought is true because when react native update the framework version, many libraries just screwed😂😂😂

    • @Adrian_kal
      @Adrian_kal 11 หลายเดือนก่อน

      @@mac.ignacio trusting your own code is the worst you can ever do. You're the only one who tested it. Compare that to thousands of people who develop using bloc or riverpod and millions of users of apps written with those. Your code will fail, will have security vulnerabilities, will not be well documented etc. It's full time job to maintain riverpod. If you do your libraries well, you'll never build any app for your clients.

  • @thenightguy6816
    @thenightguy6816 ปีที่แล้ว +2

    The folder structure is a bit complex, but a great video nonetheless. I would much like to see a cleaner implementation without relying on multiple dependencies. A question, at this moment, i was working on a hobby project of mysql node js api which i could call using retrofit. Flutter Bloc has went through a lot of updates. If Possible Please do an indepth video on Hydrated Bloc pattern and Retrofit CRUD Requests Would love to see your take on that.

    • @ka61er
      @ka61er ปีที่แล้ว +2

      no bro, this structure is very popular and easiest in mobile to understand and maintain

    • @oduyhung215
      @oduyhung215 11 หลายเดือนก่อน

      @@ka61er i have a question that what would we do if two features need to call the same endpoint? we will create 2 repository for each feature with the same code ?

  • @emanishregmi
    @emanishregmi 7 หลายเดือนก่อน

    Then where should I set my user token value for dio options headers?

  • @dnsl5384
    @dnsl5384 10 หลายเดือนก่อน

    what is the difference between this architecture, MVP, MVC, or MVVM
    and which is better

  • @kuttusanyt6967
    @kuttusanyt6967 ปีที่แล้ว

    instead of DataSuccess and DataFailed we can use Functional programming..

  • @yoriichi28
    @yoriichi28 5 หลายเดือนก่อน

    Best video out there for flutter clean architecture
    Still i've some confusion can you help me?

    • @flutterguys
      @flutterguys  5 หลายเดือนก่อน

      Yes sure

    • @yoriichi28
      @yoriichi28 4 หลายเดือนก่อน

      ​@@flutterguys
      Suppose there is some variable like bool , string or any variable that can change UI like isSaved Something like that so if we need to handle them how we can
      do we need to declare those in UI or bloc file for this clean architecture ?
      Like in Getx we can declare in controller file but in this structure how we can manage
      As u said in bloc there will be only less logic like calling apiRepo/use case so can you explain that one?
      It will be great.
      Also more question on any sdk implementation like firebase services or suppose we are using any ChatSdk so how do we manage that in clean architecture
      where should we create all services in this structure.

  • @adipati27ma
    @adipati27ma 6 หลายเดือนก่อน

    Great videos! but I have question, why after I remove the saved article, it's UI didn't re-render...? (removed article didn't disappeared)
    I have to go back to the prev page, then go again to Saved Articles page to get the UI changing (removed article has disappeared)

    • @adipati27ma
      @adipati27ma 6 หลายเดือนก่อน

      And if I built it into release .apk, the news didn't load (the application just layout with no data)..
      please answer if you have some insight

    • @flutterguys
      @flutterguys  6 หลายเดือนก่อน

      You have to internet permission in AndroidManifest to work in release mode

    • @flutterguys
      @flutterguys  6 หลายเดือนก่อน

      Please check with source code or clone project from Github

    • @adipati27ma
      @adipati27ma 6 หลายเดือนก่อน

      @@flutterguys Ohh okay thanks for your reply! appreciate it, I'll check it right away

  • @Voltra_
    @Voltra_ ปีที่แล้ว

    The DAO should be injected, not the whole database

  • @nahomd9797
    @nahomd9797 9 หลายเดือนก่อน

    Thanks for the detailed explanation on the architecture....can you show how to cache remote responses to local Database too....

  • @batuhankuru9999
    @batuhankuru9999 ปีที่แล้ว

    As we didn't use the fromjson method but it didn't pose a problem why?

  • @trung645
    @trung645 24 วันที่ผ่านมา

    Is this the codebase structure to start with for any Flutter project?

    • @flutterguys
      @flutterguys  24 วันที่ผ่านมา

      Not small

    • @trung645
      @trung645 22 วันที่ผ่านมา

      @@flutterguys is this three-tier architecture?

  • @alirezabashi98
    @alirezabashi98 8 หลายเดือนก่อน

    Why didn't you use either instead of data state?

    • @flutterguys
      @flutterguys  8 หลายเดือนก่อน

      I try not to use the library as much as possible

  • @akliatharia
    @akliatharia ปีที่แล้ว

    thnx, please a clean aechitecture project with Hive and bloc

  • @Polite_person_
    @Polite_person_ ปีที่แล้ว

    Hi. Nice tutorial, but method extract is bad practice . Or no?

  • @surbhipaliwal3576
    @surbhipaliwal3576 6 หลายเดือนก่อน +1

    is it with mvc patter

    • @flutterguys
      @flutterguys  6 หลายเดือนก่อน

      No , Clean Architecture

    • @surbhipaliwal3576
      @surbhipaliwal3576 6 หลายเดือนก่อน

      Do you have any video with mvc

  • @raghavendrakj4976
    @raghavendrakj4976 5 หลายเดือนก่อน

    Good.
    But i have doubt, is calling initialize dependencies in main methods does impact on the performance of the app, since in big app with 1000 block and more repo, how we can do it better way

    • @flutterguys
      @flutterguys  5 หลายเดือนก่อน

      No this is not heavy operation.
      It is just registration

    • @raghavendrakj4976
      @raghavendrakj4976 5 หลายเดือนก่อน

      Thank you so much!
      I'd appreciate some advice.
      We're developing a Flutter web application with three main components: an admin section for creating assessments and surveys, a user section for taking them, and a landing page.
      My manager, unfamiliar with Flutter, suggests using it for the entire project. However, with a year's experience in Flutter, I'm proposing separating the sections to reduce load times, possibly using Next.js for the user end.
      What's your opinion? Your input would be valuable in making a decision."

    • @flutterguys
      @flutterguys  5 หลายเดือนก่อน +1

      @@raghavendrakj4976
      Using flutter web just for admin side
      flutter web has problems which are not good for user side

    • @raghavendrakj4976
      @raghavendrakj4976 5 หลายเดือนก่อน

      @@flutterguys thankyou so much

  • @muhammadissasabbagh1540
    @muhammadissasabbagh1540 8 หลายเดือนก่อน +1

    Best clean arch explaining , thanks a lot🥳

  • @Anilkumar-ec8sj
    @Anilkumar-ec8sj ปีที่แล้ว

    why not hive? retrofit really need dio can do most of the work ?

  • @dylanroman7738
    @dylanroman7738 ปีที่แล้ว

    The video I should have seen before starting the application I’m working on xD

  • @moamnhmdany
    @moamnhmdany 21 วันที่ผ่านมา

    thanks

  • @raressimon9271
    @raressimon9271 7 หลายเดือนก่อน

    ok but if we want to make a post for register?

  • @ezscootrr
    @ezscootrr 11 หลายเดือนก่อน

    This could have been better if you made a bootcamp style. I will gladly watch a 24 hour version of it.

  • @urinbayeeva24
    @urinbayeeva24 4 หลายเดือนก่อน

    hi what about other methods post put delete?

  • @Quicky121
    @Quicky121 ปีที่แล้ว

    I have some concern about the ArticleState at 19:02 . Is safe using bang operator on 'props' method? I mean, both parameters are nullable so if we have the data the error will be null and I expect that there will be a crash. No?

  • @AmitThakur-eg8kb
    @AmitThakur-eg8kb ปีที่แล้ว

    Hello, can you tell how to pass bloc reference from one screen to others.

  • @sivsovanpanhavorn6296
    @sivsovanpanhavorn6296 5 หลายเดือนก่อน

    this is the first clean one ever and advance

  • @manirahmanzadeh7812
    @manirahmanzadeh7812 9 หลายเดือนก่อน +1

    Learned a lot. Thanks!

  • @siyandaphakathi1860
    @siyandaphakathi1860 2 หลายเดือนก่อน

    Bro you explainstions🔥🔥🔥

    • @flutterguys
      @flutterguys  หลายเดือนก่อน

      Appreciate that

  • @mohammadnajjar7892
    @mohammadnajjar7892 9 หลายเดือนก่อน

    i love you

  • @_Sp4Rx_
    @_Sp4Rx_ 5 หลายเดือนก่อน

    We should not modify *.g.dart files here 28:13 as it will override the next generation .