Uploaded September 2018 | Updated November 2026, 3 hours ago
π Get the code from this tutorial ππ
resocoder.com/di-kodein-mvvm
π Kodein Docs: kodein.org/Kodein-DI
Start saving time now by planning weekly with Week Sweep: bit.ly/2Jf3QA0
Not a single software developer ever said that a more loosely coupled code gives him headaches. On the contrary, tight coupling can and will create a bunch of things that are hard to deal with.
But first, what is that "loose coupling"? Loose coupling means not instantiating dependencies of a class directly but getting them from a centralized place. Dependencies are simply classes which are needed by other classes. For example, a view model needs a repository, so the repository is a dependency of the view model.
Loose coupling also means that your classes operate with their dependencies through an interface and not directly with their concrete implementation. This allows you to swap implementations really easily. For example, a production implementation of a database will store data on a remote server, while a test implementation will store data only locally.
In this tutorial you are going to learn how to put what's written above into practice by using a dependency injection framework called Kodein. It is specifically designed to work well with Kotlin and it's also compatible with Java.
Go to my website for more information, code examples and articles:
β resocoder.com
Follow me on social media:
β facebook.com/resocoder
β twitter.com/resocoder
π Get the code from this tutorial ππ
resocoder.com/di-kodein-mvvm
π Kodein Docs: kodein.org/Kodein-DI
Start saving time now by planning weekly with Week Sweep: bit.ly/2Jf3QA0
Not a single software developer ever said that a more loosely coupled code gives him headaches. On the contrary, tight coupling can and will create a bunch of things that are hard to deal with.
But first, what is that "loose coupling"? Loose coupling means not instantiating dependencies of a class directly but getting them from a centralized place. Dependencies are simply classes which are needed by other classes. For example, a view model needs a repository, so the repository is a dependency of the view model.
Loose coupling also means that your classes operate with their dependencies through an interface and not directly with their concrete implementation. This allows you to swap implementations really easily. For example, a production implementation of a database will store data on a remote server, while a test implementation will store data only locally.
In this tutorial you are going to learn how to put what's written above into practice by using a dependency injection framework called Kodein. It is specifically designed to work well with Kotlin and it's also compatible with Java.
Go to my website for more information, code examples and articles:
β resocoder.com
Follow me on social media:
β facebook.com/resocoder
β twitter.com/resocoder


![Flutter TDD Clean Architecture Course [6] β Repository Implementation
π Learn from the written tutorial ππ
https://resocoder.com/flutter-tdd-clean-architecture-ep6
π¨βπ» Do you write good code? Find out now!
https://resocoder.com/good-code-quiz
After the previous part, we now have all the contracts of the Repositorys dependencies in place. Those dependencies are the local and remote Data Source and also the NetworkInfo class, for finding out if the user is online. Mocking these dependencies will allow us to implement the Repository class using test-driven development.
Go to my website for more information, code examples, and articles:
β https://resocoder.com
Follow me on social media:
β https://instagram.com/resocoder
β https://www.facebook.com/resocoder
β https://twitter.com/resocoder Flutter TDD Clean Architecture Course [6] β Repository Implementation](https://i.ytimg.com/vi/bfEKPKKy9dA/mqdefault.jpg)
![Flutter Firebase & DDD Course [7] - Injectable & Linting
π Get the code ππ
https://github.com/ResoCoder/flutter-ddd-firebase-course
π§ Get Flutter news π° and resources:
π http://flutter.education
π¨βπ» Do you write good code? Find out now!
https://resocoder.com/good-code-quiz
Weve gone through some tough concepts in the previous parts. From value objects to an authentication facade, weve set up the core parts of getting the first feature of the app ready, that is, signing in.
Before moving any further to implementing the user interface, lets step back and do things which may not be as glamorous as what weve done up until now, but are still important. For example, dependency injection and linting.
Go to my website for more information, code examples, and articles:
β https://resocoder.com
Follow me on social media:
β https://instagram.com/resocoder
β https://www.facebook.com/resocoder
β https://twitter.com/resocoder Flutter Firebase & DDD Course [7] - Injectable & Linting](https://i.ytimg.com/vi/c0MUcUpmViU/mqdefault.jpg)






