Flutter TDD Clean Architecture Course [13] - Dependency Injection

Поділитися
Вставка
  • Опубліковано 28 лип 2024
  • 📗 Learn from the written tutorial 👇👇
    resocoder.com/flutter-tdd-cle...
    👨‍💻 Do you write good code? Find out now!
    resocoder.com/good-code-quiz
    We have all of the individual pieces of the app architecture in place. Before we can utilize them by building a UI though, we have to connect them together. Since every class is decoupled from its dependencies by accepting them through the constructor, we somehow have to pass them in.
    We've been doing this all along in tests with the ​mocked​ classes. Now, however, comes the time to pass in real production classes using a service locator.
    Go to my website for more information, code examples, and articles:
    ● resocoder.com
    Follow me on social media:
    ● / resocoder
    ● / resocoder
    ● / resocoder

КОМЕНТАРІ • 58

  • @aytunch
    @aytunch 4 роки тому +45

    Can't wait for the next part. I am curious how they all connect to each other:) This is like a Netflix show:D

  • @nestorperez1482
    @nestorperez1482 3 роки тому +18

    I dont know since which version, but now you can do sl.registerLazySingletonAsync(), this method allow you to instantiate async dependencies, so await async in init() is not longer necessary; you can implement shared prefs like this;
    sl.registerLazySingletonAsync(
    () => SharedPreferences.getInstance());

  • @Mhmd_SHA
    @Mhmd_SHA 10 днів тому

    Oh... Man.. this playlist is 💎
    Even after this years. 😩
    Thanks sir..❤
    I hope you're doing great 🥳

  • @ino9138
    @ino9138 4 роки тому +1

    man i am glad somebody out there invented depedancy injection at some point. this thing is gold

  • @mugume
    @mugume Рік тому +3

    Bro 😀, this is beautiful. I have followed your tutorials one by one. You have indeed prepared me for real app development. I am now building better, faster and more stable apps.

  • @christianonwe2045
    @christianonwe2045 4 роки тому +2

    I really can't appreciate your effort enough. Thank you

  • @alfonsoisraelosorioavilez7
    @alfonsoisraelosorioavilez7 4 роки тому +5

    Excellent reso, I had used Get It in some projects, but as always, you add that expertis that makes us go more there and do things in the best way, simply the best video tutorials.

  • @ShadowInfest
    @ShadowInfest 4 роки тому +6

    Thank you for pushing continouesly, I can't even get enough free time to keep up the pace 😂 To many different things to do... To many ideas and hobbies.
    Keep up the good work! 🔥

  • @max_ishere
    @max_ishere 2 роки тому +1

    This series is so cool! I even made the whole thing in rust after my non clean approach collapsed pretty quickly

  • @dokinkon
    @dokinkon 4 роки тому +3

    Awesome tutorial, thanks your effort.

  • @davidfox4253
    @davidfox4253 4 роки тому +2

    Once again awesome!!!

  • @abudev
    @abudev 4 роки тому +1

    Thank you very much ! Nice tutorials !

  • @SabedoriaUniversal777
    @SabedoriaUniversal777 2 роки тому +1

    man you are the best. Thanks for sharing your knowledge

  • @tareksellami7346
    @tareksellami7346 3 роки тому

    Thank you for the perfect content

  • @mushexantaranian2599
    @mushexantaranian2599 3 роки тому

    Great content, thanks for sharing. Btw, docs mention that from v5.0 on you can pass a `dispose` function when registering any Singletons.

  • @jesselima_dev
    @jesselima_dev 4 роки тому

    Awesome!!!!
    Going to the last one!!! \o/

  • @dawidniegrebecki2205
    @dawidniegrebecki2205 4 роки тому

    Great video!

  • @asettani
    @asettani 4 роки тому

    Greaat job brother !

  • @brunodonascimentomaciel9984
    @brunodonascimentomaciel9984 2 роки тому

    top-notch quality content

  • @NivenShah
    @NivenShah 4 роки тому +1

    Hi Matej, thanks again for continuing this great series. I don't think there is anyone else taking on tricky topics like TDD! If we are using the Provider package to make services available to the UI, is 'Get It' still necessary? Aren't they providing the same functionality?

  • @swplogic4158
    @swplogic4158 4 роки тому

    Great :D

  • @tahirdevlog2047
    @tahirdevlog2047 3 роки тому +1

    how dare these 3 people disliked this.Thank you Reso

  • @amansingh.h716
    @amansingh.h716 2 роки тому

    finally today i get all my answers about those abstract classes which we create but never pass anything

  • @Starrk321
    @Starrk321 3 роки тому +1

    I think we need a video about how to use dependency injection without get_it, not all of the companies like to use external packages for all the implementation as needed

  • @aophamminh8983
    @aophamminh8983 3 роки тому

    I ran into Unhandled Exception and added "WidgetsFlutterBinding.ensureInitialized();" in main method, before runApp() and it works

  • @agueroalvaro
    @agueroalvaro 3 роки тому

    Thank you very much, I have a question and maybe someone can answer me: if the main () method is async, then the whole application will be async?

  • @underfilho
    @underfilho 2 роки тому +2

    If I want to get data from another previous page how can I do it? If the bloc is a factory, it will return a new instance when I call it in getIt, so all the data is new and not from the previous screen, how can I do it?

  • @varunkamani2528
    @varunkamani2528 4 роки тому

    what if I have multiple implementations of repository and I want to switch between them at runtime?

  • @pathakvivek7865
    @pathakvivek7865 4 роки тому +2

    I hope you are already planning to add new feature in this project and link with the number trivia feature.
    Thank you again for such great and quality content.

    • @ResoCoder
      @ResoCoder  4 роки тому +2

      I'm not going to expand on this project further but there are certainly more tutorials coming!

    • @pathakvivek7865
      @pathakvivek7865 4 роки тому +1

      @@ResoCoder i wish it will also based on TDD

    • @pathakvivek7865
      @pathakvivek7865 4 роки тому

      We are supposed to get the last part of this tutorial today, don't we?

  • @swplogic4158
    @swplogic4158 4 роки тому +2

    Gosto muito dos seus tutoriais...

    • @jesselima_dev
      @jesselima_dev 4 роки тому +4

      Translation: I Like your tutorials so much.

    • @ResoCoder
      @ResoCoder  4 роки тому +7

      I'm a simple man, I hear that, I like.

  • @tinoutech5016
    @tinoutech5016 2 роки тому

    Any idea on how to register Hive DB?

  • @TarekkMA
    @TarekkMA 4 роки тому

    Where do the GraphQL queries fit in the clean arch. does it belong to the data layer? or the domain layer? By using GraphQL I tell the backend what is needed for the application to render for example a screen, so the query details seem like business logic details. Abstracting it in the data layer would require to have queries for every use case scenario. This seems like shifting the domain details to the data layer. What is your take on this.

  • @sheikh.salman101
    @sheikh.salman101 Рік тому

    Amazing content. BUT
    I have a mixed feeling about the code organization of this part. its maybe okay for this number trivia app, but for larger apps injection_container file will be too big and unmanageable. also it seems redundant to initiate all dependency of every feature/pages beforehand, even though that feature/page is not used yet.
    PLEASE: is there a more concise way for dependency injection? maybe in separate files of each feature/page?
    Thanks for the informative playlist.

  • @TarekkMA
    @TarekkMA 4 роки тому

    Thanks a lot, reso for the grate greate content.
    I have a question about how can you have something like scopes in Dagger. I have an application that will add an interceptor with access_token to the HTTP client. so if the user does log in the HTTP client should change and every dep that uses it.
    I ended up creating a class named AuthManager extending ChangeNotifer that manages the user lifecycle in the application. and ApiClient class that I will inject a factory builder function that is used to build the HTTP client. ApiClient is subscribed to AuthManager changes whenever it changes ApiClient rebuild the HTTP instance using the factory builder function.
    what is your opinion and what would you do differently?

    • @TarekkMA
      @TarekkMA 4 роки тому

      ​@Essenc Thank you a lot for your comment. This is what I have ended up doing. pastebin.com/Q71E0mky . You approach is okay but the issue rises when the `UserInfo` that contains the logged-in user details is a dependency to other classes. I was looking for a way so if I change a dependency in the top of the dependency graph all it dependent children will rebuild. This was achievable in android using Dagger library using @scopes. This also can be solved if I use the Provider library but using ProxyProvider is so much boilerplate. what do you think ?

  • @rahmatsugiarto859
    @rahmatsugiarto859 Рік тому

    cool

  • @arshadmohammmed1219
    @arshadmohammmed1219 2 роки тому

    can i get the whole source code of your Number trivia app? i am stuck between getIt function

  • @temzints
    @temzints 4 роки тому +1

    Please make a tutorial for the new 'flutter_bloc' 1.0.0 version its so much different from your previous videos

    • @ResoCoder
      @ResoCoder  4 роки тому +5

      It's on the way!

    • @temzints
      @temzints 4 роки тому +1

      @@ResoCoder Thank you love your tutorials, keep it up ❤️

    • @temzints
      @temzints 4 роки тому

      Any news?

    •  4 роки тому +1

      It's not that different at all. Just two things that you have to change inside bloc_test file: 1. Use "bloc.add(myEvent)" insead of "bloc.dispatch(myEvent)"; 2. Instead of "expectLater(bloc.state, emitsInOrder(expected);" use "expectLater(bloc, emitsInOrder(expected));"... Hope this helps!

    • @shantanooh6455
      @shantanooh6455 4 роки тому

      @@ResoCoder Any update on this? Thanks very much for such an awesome tutorial series.

  • @diego.coder26
    @diego.coder26 4 роки тому +1

    alternative to get_it?

  • @galacticashunnek1354
    @galacticashunnek1354 Рік тому

    dependency injections

  • @shakirkasmani
    @shakirkasmani 4 роки тому

    How to add dependency Injection in this project
    stackoverflow.com/questions/61084640/how-to-add-dependency-injection-in-flutter-with-provider

  • @michalrv3066
    @michalrv3066 4 роки тому

    You provide great information that is essential for developers to know about. However, I wish the tutorials were a bit shorter, less repetition of not needed stuff (e.g. check my blog tutorial, or this sort of double intro). At times it seems like explanation could have been provided in a more concise manner. Some basic stuff should not been explained in my opinion here (e.g. details about what is DI - architecture is a bit of a level up so most likely people already know about it, they might just want to know implementation in flutter). Overall, great videos. I've learnt plenty from about about mobile development.