MVVM / MVI Repository Pattern with Hilt

  Рет қаралды 67,529

CodingWithMitch

CodingWithMitch

4 жыл бұрын

The best android courses in the world: codingwithmitch.com/
Watch the HILT course here (FREE): codingwithmitch.com/courses/h...
A very simple example using MVVM / MVI, Repository Pattern, Hilt dependency injection, Network layer with Retrofit, Caching layer with Room, Coroutines.
This is a complete example so you can see the big picture when it comes to using Hilt and android architecture.
Code: github.com/mitchtabian/Dagger...
Instagram: / codingwithmitch
Twitter: / mitch_tabian
.
.
#AndroidDev

Пікірлер: 179
@TheAnilmaddala
@TheAnilmaddala 3 жыл бұрын
This is so useful! and I keep coming back to this. So I created myself a breakdown :) 0:00 Project Setup 3:35 Remote Model creation and Retrofit Setup 12:00 EntityMapper 16:00 Room Setup and Local cache model creation 25:00 Dependency Injection - App + Retrofit 32:05 Dependency Injection - Room 35:00 DataState 38:00 MainRepository creation 43:20 MainViewModel 46:00 MVI 51:30 MainActivity
@AKAzadanine
@AKAzadanine Жыл бұрын
Thanks
@sheenfabile9460
@sheenfabile9460 4 жыл бұрын
This is what im looking for! MVI using flow. Will get membership to support your tutorial. Thank you!
@msontrent9936
@msontrent9936 2 ай бұрын
Really good tutorial. Far more useful than learning it in a classroom. Thanks for taking the time.
@vrajeshhirani
@vrajeshhirani 3 жыл бұрын
Have been browsing quite a few tutorials on MVI & Clean Architecture and yours is definitely the one that I enjoyed watching. Your way of teaching is really good and I appreciate your hard work behind this. Thank you so much.
@lbars
@lbars 3 жыл бұрын
Yes, exactly what I needed. All architecture concepts at the same video. Thank you CodingWithMitch ❤
@dahlola
@dahlola 4 жыл бұрын
Nice tutorial! For anyone wondering, "dao" stands for Data Access Object. So in the context of an database it handles the access to the data.
@zhanyshmasirov4611
@zhanyshmasirov4611 2 жыл бұрын
thank you Matthew(Mitch) , actually english isn't my mother tongue , I'm actually viewing Russian Android developers Channel in youtube , but they're not explaing on begining of project , they're explaining from already done projects and its very heavy to understand if not begin explanation from begining , i'm beginner but I've undertand everything! thank once again. because you've explained from begining in project
@bro_chenzox
@bro_chenzox 3 жыл бұрын
The most excellent explanation format (a whole hour) - everything from scratch and in order, as in real life, despite the fact that the volume can twitch the eye, but if you do not rush and think about each embedded topic with understanding, it turns out incredibly cool and understandable!!
@codingwithmitch
@codingwithmitch 3 жыл бұрын
"despite the fact that the volume can twitch the eye" Like the volume of the content or the volume of my audio?
@bro_chenzox
@bro_chenzox 3 жыл бұрын
@@codingwithmitch Comparing to other Hilt related videos content))
@edvardgrei1257
@edvardgrei1257 3 жыл бұрын
Thank you Mitch. It really opened my eyes. Going to take your paid course for sure. Good Job
@foivosstamopoulos9709
@foivosstamopoulos9709 3 жыл бұрын
PERFECT tutorial! So much knowledge combined. Thank you once again
@maksonic_official
@maksonic_official 4 жыл бұрын
powerful work! Thanks so much for this video, I will definitely go to your site to see the lessons!
@superjkmax88
@superjkmax88 4 жыл бұрын
This is an awesome video Mitch! I wish credit cards were available in my country so I could buy a membership on your site. I’ve been reading the courses’ source code on github and failing to understand some concepts fully, this video helped me immensely!
@amateur_gamer101
@amateur_gamer101 2 жыл бұрын
I could literally kiss you for this tutorial 😭😭 its so easy to understand. You just got a new follower.
@vishwaraghavendra8332
@vishwaraghavendra8332 4 жыл бұрын
Omg!! Finally.. Was waiting for this tutorial
@lovemashup7975
@lovemashup7975 2 жыл бұрын
It is definitely the most useful demo I have ever seen. Thanks Mitch for your contribution, it helps a lot :)
@arulwastaken
@arulwastaken 3 жыл бұрын
Thank you mitch for wonderful explanation. im working on android almost 2 year with java now i can understand kotline with best approach by watching all your tutorials. I'll suggest your channel and blod and site to colleague.
@cdmunoz
@cdmunoz 4 жыл бұрын
Awesome job! Thanks for sharing it with all the community
@hosseinmirzazadeh290
@hosseinmirzazadeh290 3 жыл бұрын
You're doing a great job with these tutorials.
@dineshkhedkar8721
@dineshkhedkar8721 4 жыл бұрын
Thanks!!! Everything on one plate. Great Work
@nitinnegi9343
@nitinnegi9343 4 жыл бұрын
Awesome.. "YOU NAILED IT"
@jimpauloovejera2599
@jimpauloovejera2599 3 жыл бұрын
This thing is a gold mine! Thanks for the free stuff!
@mattgraves3709
@mattgraves3709 3 жыл бұрын
I enjoyed this implementation example. Thanks Mitch
@Irshu
@Irshu 3 жыл бұрын
thanks Mitch, finally a terrific tutorial!
@bahaaka828
@bahaaka828 4 жыл бұрын
i really liked it. make more of these kind of videos 1 hour contains the summary of 8 hours course
@wisnusuryawardhana7891
@wisnusuryawardhana7891 4 жыл бұрын
THANKS MITCH!!!
@jamilxt
@jamilxt 4 жыл бұрын
That's what I was looking for. Thank you. ^_^
@gabvideos237
@gabvideos237 4 жыл бұрын
Thank you for this tutorial! Intuitive & Very useful !
@georgepereiramarques1445
@georgepereiramarques1445 3 жыл бұрын
Thanks man, such a nice tutorial! Congrats!
@ofirkosto
@ofirkosto 2 жыл бұрын
Awesome video !! Thank you Mitch you are doing a great work you should be proud of yourself!
@SerarEstaifan
@SerarEstaifan 4 жыл бұрын
The best ever! Thank you sir 🙏🏻
@user-cf5ks8cv8l
@user-cf5ks8cv8l 3 жыл бұрын
Thanks for clear and useful example!
@nrsingh7203
@nrsingh7203 3 жыл бұрын
wooooh!! Hats off to you man[Amazing explanation of android components]... I wish I can hit more likes...
@jackli1924
@jackli1924 Жыл бұрын
Thank you Mitch,a wonderful video! Your tech is so excellent and your explaination is so consice and awesome!
@adamgardner1986
@adamgardner1986 3 жыл бұрын
Awesome video and thank you. Very helpful. Now to figure out how to test that ViewModel and Flow.
@alvaroisea2259
@alvaroisea2259 3 жыл бұрын
Big fan of your tutorials man !, I'm even giving a thumbs up without even watching the whole video sometimes
@codingwithmitch
@codingwithmitch 3 жыл бұрын
that's what I like to hear
@ozgurtas4508
@ozgurtas4508 4 жыл бұрын
thanks mitch, very good tutorial
@alitonoliveira1700
@alitonoliveira1700 4 жыл бұрын
Awesome and fast like a bullet :)
@gulabpatel7477
@gulabpatel7477 3 жыл бұрын
1000 plus salute man. Your explanation methods are so easy. I don't even know and experience In kotlin still I can understand all the things very clear manners
@malpv
@malpv 2 жыл бұрын
Nice tutorial! Thanks! Saludos desde Chile!
@xxluciferinxx
@xxluciferinxx 3 жыл бұрын
thanks for this amazing video! leared a lot from this video.
@SpaceTimeBeing_
@SpaceTimeBeing_ 4 жыл бұрын
Perfect tutorial!
@mytubekt
@mytubekt 3 жыл бұрын
Very helpful video. Thanks!
@bjugdbjk
@bjugdbjk 3 жыл бұрын
The best vid to know about modern android development using kotlin,livedata,viewmodel, Hilt and MVi architecture, if the same thing if we want to do with Java and traditional ways..it gonna be 4hrs long r even more...u r awesome Mitch.
@lbars
@lbars 3 жыл бұрын
and probably 2 hour for debugging things 😂
@vahidhoseini1723
@vahidhoseini1723 3 жыл бұрын
great, good job mitch.
@aravind_us
@aravind_us 2 жыл бұрын
No words to say....it's awesome tutorial....😍😍😍
@ChrisAthanas
@ChrisAthanas 3 жыл бұрын
Gettin close to 100k!!!
@fahtulrahman8231
@fahtulrahman8231 3 жыл бұрын
Still The best teacher for android dev i've ever seen hehe
@bhuvneshvarma7843
@bhuvneshvarma7843 3 жыл бұрын
Very good quality code!👏👏👏
@mrsoommy9162
@mrsoommy9162 3 жыл бұрын
Great tutorial! Thanks a lot
@jaloliddinabdullaev2310
@jaloliddinabdullaev2310 Жыл бұрын
Best tutorial for MVI on youtube, thanks
@codingwithmitch
@codingwithmitch Жыл бұрын
Ya man no worries
@foreverrafs
@foreverrafs 4 жыл бұрын
oh my God this is so good.
@aliakkawi4759
@aliakkawi4759 3 жыл бұрын
Awesome tutorial, thanks a lot
@abhisheksaxena518
@abhisheksaxena518 4 жыл бұрын
Amazing tutorial!!
@polarisnation201
@polarisnation201 3 жыл бұрын
This video is what i need. Thanks you
@muhammadsalman4389
@muhammadsalman4389 4 жыл бұрын
Thanks for MVI ❤️
@girishak9404
@girishak9404 4 жыл бұрын
Wow that's fantastic video. Thanks Mike.
@codingwithmitch
@codingwithmitch 4 жыл бұрын
*Mitch*
@girishak9404
@girishak9404 4 жыл бұрын
CodingWithMitch Yes Mitch 😂
@mahmoudramadan8407
@mahmoudramadan8407 3 жыл бұрын
I love it , well done
@lazaroyesid
@lazaroyesid 2 жыл бұрын
Thanks!! well explained !
@gunjotsingh3638
@gunjotsingh3638 2 жыл бұрын
Huge Help !! 🙌🏻
@M-MZ
@M-MZ 3 жыл бұрын
Great stuff! Thanks
@suren6413
@suren6413 2 жыл бұрын
Am an average developer only. But I have learned a lot by your tutorials. Thanks you a lot Mitch
@charlien759
@charlien759 3 жыл бұрын
Good video, however with new projects Gson isn't the ideal choice, Jake Wharton says to use kotlinx.serialization, Moshi or Jackson. Moshi is basically Gson V3 in all but name.
@lional4898
@lional4898 3 жыл бұрын
Great Job!
@pejmanazad5852
@pejmanazad5852 4 жыл бұрын
My brain is burning. 🔥
@Firespirit233
@Firespirit233 3 жыл бұрын
why? this is quite easy, and mitch is explaining it very well and simple
@ryujin5400
@ryujin5400 4 жыл бұрын
Thanks , This is Awesome
@MariusDuna
@MariusDuna 2 жыл бұрын
Regarding with creating models, you can find JSON to KT data class Android Studio extension. You just paste there the JSON and data classes are created for you automatically
@pgaurav72
@pgaurav72 4 жыл бұрын
Hilt is awsome!
@GabrielNovakovskiNunes
@GabrielNovakovskiNunes 2 жыл бұрын
Awesome!
@alexandretrew3737
@alexandretrew3737 3 жыл бұрын
F***ing great!, super helpful !
@shwetankbhardwaj3190
@shwetankbhardwaj3190 4 жыл бұрын
Can you please explain more about Entity mapper. Like, how to map an entity to a global model if we have multiple hierarchies of objects
@bjugdbjk
@bjugdbjk 3 жыл бұрын
Think in a way like moving data from one class to another class, with the same fields available.
@muhammadhumzakhan9888
@muhammadhumzakhan9888 3 жыл бұрын
Hats off to you 🤝
@aalap03
@aalap03 3 жыл бұрын
Superb explanation keep going. Just at 54:55 you can use progressbar.isVisible = isDisplayed to avoid checking if condition and let that view extension method take care of it. :)
@azamatmahkamov263
@azamatmahkamov263 4 жыл бұрын
Nice tutorial, very neat. I have one question though, if MVI has State mapper in viewModel, does it mean, we can build very large one viewmodel for the whole application?
@edwin846
@edwin846 3 жыл бұрын
Nice video! Keep it up! One question that I have is what is the reason of using dependency injection when Kotlin object can be called from anywhere of the code. For example, the Retrofit module you created in the video can be called directly in the MainRepository class without any DI dependencies. Thanks
@gillesjack9619
@gillesjack9619 3 жыл бұрын
Thanks Mitch. That was great. Do you have the same kind of video with a Room database containing 2 tables joined by a SQL inner join (external key in one of the table). If not, take it as a suggestion because all tutorials I have seen so far only use single SQL table example. I wonder how to use SQL INNER JOIN query in room and integrate it in a MVVM project.
@benjaminmorales9276
@benjaminmorales9276 3 жыл бұрын
Hi Mitch, I really appreciate this session, you explained a lot of concepts in an incredible way. Thanks for that!. I would like to ask you if could you create or design a Base Use Case with this approach. I think use Flow makes the things more efficient but, I tried and I could't create a Base Use Case. Could you please show us a way?
@applombaa6278
@applombaa6278 3 жыл бұрын
This is something amazing
@antoniokomangyudistira4150
@antoniokomangyudistira4150 4 жыл бұрын
Thank you
@wah_yar_tiwari
@wah_yar_tiwari 3 жыл бұрын
Thank you💯
@hnim2292
@hnim2292 4 жыл бұрын
Hi Mitch, thanks for this example. I have a question, why class DataState and not DataState, what the "out" does?
@codingwithmitch
@codingwithmitch 4 жыл бұрын
kotlinlang.org/docs/reference/generics.html
@bradyaiello6830
@bradyaiello6830 4 жыл бұрын
Only "pk" needs the @SerializedName, because it's the only field whose name differs from the JSON response. You also don't need @ColumnInfo unless the field name differs from the column name in your table.
@codingwithmitch
@codingwithmitch 4 жыл бұрын
Just habit
@akthamahmed2171
@akthamahmed2171 2 жыл бұрын
Awsome 👌 thanks you 🧡
@Serg13975
@Serg13975 3 жыл бұрын
Great Tutorial. What should I do if I need to pass a blog as an argument to the viewmodel in case I want to insert it . How can I incorporate it to the MainStateEvent?
@AhsanAli-vz6mg
@AhsanAli-vz6mg 4 жыл бұрын
Superb
@federicocreti4699
@federicocreti4699 3 жыл бұрын
Hello Man, I have a question. I never used before MVI pattern. I want to ask: I have a login screen (a fragment) which uses OAuth2 authentication. I used a viewmodel behind this fragment. I created a sealed state class in the ViewModel, in order to manage the state between the fragment and viewmodel. Is correct set the state both from viewmodel and fragment? I mean, there are some states which are managed from the fragment, so I have to set the state from the fragment, and other states which has to be managed from the viewmodel (and through livedate I update/inform the fragment). Is this approach correct? Or the states should be set just from Fragment? Then I have some states for example: data class ValidLoginStateEvent(val sessionClient: SessionClient) : LoginStateEvent() data class NavigateToUserListEvent(val sessionClient: SessionClient) : LoginStateEvent() ValidLoginStateEvent is set by Fragment. In the ViewModel I have this: when (loginStateEvent) { . . is LoginStateEvent.ValidLoginStateEvent -> { bytenerRepository.setSessionClient(loginStateEvent.sessionClient) setLoginStateEvent(LoginStateEvent.NavigateToUserListEvent(loginStateEvent.sessionClient)) } is LoginStateEvent.NavigateToUserListEvent -> { _state.value = loginStateEvent } . . } Is this approach correct?
@LetrixAR
@LetrixAR 3 жыл бұрын
This was really useful, thanks. P.S: Add chapters to the video please!
@niazsagor
@niazsagor 2 жыл бұрын
awesome
@myyoutubeorel
@myyoutubeorel 4 жыл бұрын
Been waiting for an MVI video! Thanks alot:) Quick question Is it legit to use firebase as my backend for an app that will have quite a big user base? I read many different opinions, and I am not sure.. Thanks in advance:)
@codingwithmitch
@codingwithmitch 4 жыл бұрын
Sure why not
@arcticmax20
@arcticmax20 4 жыл бұрын
Thank you :D
@satnamsingh-qh2si
@satnamsingh-qh2si 2 жыл бұрын
🙌🏻
@techno-trickster636
@techno-trickster636 3 жыл бұрын
) how hilt know what retrofit instance to provide when we have more than 1 retrofit builder with different base URL
@arindomghosh3144
@arindomghosh3144 3 жыл бұрын
It is supper awesome
@powder77777
@powder77777 3 жыл бұрын
awsome
@aliakkawi4759
@aliakkawi4759 3 жыл бұрын
Hello Mitch and thanks for the tutorial. In the RetrofitModule we hard coded the BaseUrl, is it possible to make the BaseUrl dynamic? do we need to create a new RetrofitModule if we have requests with a different BaseUrl? Thanks.
@codingwithmitch
@codingwithmitch 3 жыл бұрын
Ya with retrofit you must
@aliakkawi4759
@aliakkawi4759 3 жыл бұрын
@@codingwithmitch Thanks a lot!
@alexandresantos8232
@alexandresantos8232 3 жыл бұрын
I have a question, how do we do this if you're using more complex data classes, for example imagin if "Blog" had another class inside, how would we deal with the data relations?
@ismailkassim6325
@ismailkassim6325 4 жыл бұрын
Can you do a video on safe args with fragment.
@AnasTariqKhan
@AnasTariqKhan 4 жыл бұрын
Hey Mitch, first of all, a very helpful tutorial, Just a question, what's the use of caching here? because if the network API fails then we're not retrieving from cache?
@codingwithmitch
@codingwithmitch 4 жыл бұрын
Just a simple example. Obviously there should be more detailed error handling
@ankitdubey9560
@ankitdubey9560 3 жыл бұрын
Should we observe to database directly in viewmodel, and also call the API. Atleast everytime the loader will not be displayed if data is already in db. However caching functionality is not clear to me.
@minaisaac507
@minaisaac507 4 жыл бұрын
thanks alot for your sincere effort, ...but I have a question : why do you provide MainRepository through Module while you own it's class so you can easily provide it through constructor injection...shouldn't we use constructor injection whenever possible?
@codingwithmitch
@codingwithmitch 4 жыл бұрын
Ya you could have. I don't know that it matters which you use.
@rajnikantpandey709
@rajnikantpandey709 3 жыл бұрын
Hi , at 44:47 min , you said that "i'm not adding @Inject at the constructor of MainRepository , i will provide this in module" but why cann't you do there only by putting the @Inject annotation , why do we need to create a seprate module for that and while i'm trying to put @Inject annotation in constructor itself , its throwing me error.
@javidsattar281
@javidsattar281 3 жыл бұрын
that's good
Hilt Dependency Injection (Kotlin Beginner Example)
21:20
CodingWithMitch
Рет қаралды 42 М.
Kotlin Coroutines Beginner Example (Android)
23:12
CodingWithMitch
Рет қаралды 158 М.
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 11 МЛН
Happy 4th of July 😂
00:12
Alyssa's Ways
Рет қаралды 63 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 2,6 МЛН
Getting Started with HILT (Dagger2)
10:10
CodingWithMitch
Рет қаралды 44 М.
LiveData deprecated? - Full Guide to StateFlow
17:03
Philipp Lackner
Рет қаралды 53 М.
Advice from a Principal Software Engineer at Amazon (Steve Huynh)
22:45
Kotlin Sealed Classes & Custom State Managment (VLog)
19:04
CodingWithMitch
Рет қаралды 22 М.
The Elm Architecture. Функциональное программирование на Android
1:28:01
Android Broadcast. Все об Андроид разработке
Рет қаралды 7 М.
Все про Dagger Hilt в Android Studio + Kotlin
52:11
Neco Ru
Рет қаралды 11 М.
Software Engineering Interviews at Big Tech (Square)
31:06
CodingWithMitch
Рет қаралды 7 М.
From Physics Student to Software Engineer
6:22
CodingWithMitch
Рет қаралды 11 М.
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 1,2 МЛН
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 1,3 МЛН
Смартфон УЛУЧШАЕТ ЗРЕНИЕ!?
0:41
ÉЖИ АКСЁНОВ
Рет қаралды 1,1 МЛН
СТРАШНЫЙ ВИРУС НА МАКБУК
0:39
Кринжовый чел
Рет қаралды 1,3 МЛН
😱Хакер взломал зашифрованный ноутбук.
0:54
Последний Оплот Безопасности
Рет қаралды 894 М.
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 2 МЛН