Dagger-Hilt in Detail - Full Course

Dagger-Hilt in Detail - Full Course

Philipp Lackner

3 года назад

81,953 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@sustainabilitybeauty3318
@sustainabilitybeauty3318 - 10.06.2023 06:09

Thank you philip, the annotation @Named one helps me to deal with the problem with multiple BASE URL, Thankkk uuuu

Ответить
@diargegaj7436
@diargegaj7436 - 02.06.2023 20:02

What if im depended on a runtime thing ?

E.g

On my app I have a number picker. With 1 and 2. If user select 1 I want to Inject X thing, if user select 2 I want to inject Y thing.
This X and Y are the same type. Type of Z. So in my viewModel (or whenever this will be used) I want only to `@Inject lateinit var test: Z`.

Ответить
@mrjackson9137
@mrjackson9137 - 19.04.2023 12:13

One more point about Dagger Hilt is that you are not able to configure it for the library project as the entry point for it always has to be the Application which is absent in the library.

Ответить
@alexloera9038
@alexloera9038 - 09.03.2023 21:45

Excellent 👍

Ответить
@hojatghasemi8628
@hojatghasemi8628 - 21.01.2023 08:21

This video needs to be updated because the gradle dependencies that are mentioned are not correct at this time and the dependency for "hilt-lifecycle-viewmodel" isn't needed in the newer versions of the library (if it's added to your project, there will be runtime errors).

Ответить
@reaperxfury9518
@reaperxfury9518 - 12.12.2022 18:37

thumbnail 😂😅🤣😂😂

Ответить
@yarivzip
@yarivzip - 08.12.2022 16:15

Hey there. I get an error when trying to run the last thing you explained with the view model. When I replace the @InstallIn(ActivityComponent..) and @ActivityScoped annotations with @IntallIn(SingletoneComponent..) and @Singleton it works. I think it's because the MainModule which provides dependencies at an activity layer relies on the AppModule which provides dependencies at application level (because it's annotated as a singleton). Am I missing something?

Ответить
@amineayachi335
@amineayachi335 - 07.12.2022 12:23

how i can create a singleton viewmodel sheard between 2 screens

Ответить
@hmasaya6409
@hmasaya6409 - 23.06.2022 21:56

すごく参考になりました。ありがとうございます!

Ответить
@btc-news
@btc-news - 21.06.2022 11:20

Sound's like you're saying "knasp" and "knas" instead of "class"

Ответить
@bunyodbekmurodov1838
@bunyodbekmurodov1838 - 16.06.2022 14:34

how can u buy video course "

Ответить
@yahussainmazloom1
@yahussainmazloom1 - 10.06.2022 08:02

Thanks for making such clear and elaborative videos. Best

Ответить
@divyanshverma2424
@divyanshverma2424 - 30.05.2022 22:07

Is @Singleton is same as 'object' keyword in Kotlin?

Ответить
@spidey5324
@spidey5324 - 17.05.2022 00:29

I finally understand what is digger hilt after days of research...

Ответить
@SohailAnsari-ek3oy
@SohailAnsari-ek3oy - 11.05.2022 10:20

ApplicationComponent is now replaced with SingletonComponent in the new version of hilt.

Ответить
@bitwisedevs469
@bitwisedevs469 - 30.04.2022 06:12

It would be awesome to explain and show things about scoping, regardless this is a good video coming from plain Dagger 2

Ответить
@anudeepananth
@anudeepananth - 16.04.2022 10:05

What if the variable string2 was created in the activity in a scenario like from IntentExtras and we need to pass it to the ViewModel without using a ViewModel factory

Ответить
@sanketbhangale5788
@sanketbhangale5788 - 13.04.2022 09:57

Thanks for such a wonderful explanation
I appreciate your efforts

Ответить
@jeckonly5853
@jeckonly5853 - 07.04.2022 11:15

i come back again!! thanks phillipp

😀Actually , you give me a lot help in Android dev!!

Ответить
@gavinmurambadoro
@gavinmurambadoro - 31.03.2022 13:42

Watching your videos feels like cheating :). Every time I struggle with something I always watch one of your relevant videos, and voila. Thanks a million times and more man...

Ответить
@muhammadardiansyah6955
@muhammadardiansyah6955 - 30.03.2022 10:30

i had error when run this code, "unrecognized attribute name module (class com.sun.tools.javac.util.sharednametable$nameimpl)". someone can help?

Ответить
@mrpi230
@mrpi230 - 24.03.2022 10:18

Thank you great explanation 🙏

Ответить
@seba23571
@seba23571 - 21.03.2022 00:55

for a strange reason I used hilt version 2.35 and it didn't work for me, then I used hilt version 2.40.5 and it worked, maybe someone has experienced the same thing

Ответить
@haykmkrtchyan7093
@haykmkrtchyan7093 - 20.03.2022 16:32

@ViewModelInject annotation doesn't exist anymore. To inject dependencies in ViewModel we need to use the same @Inject constructor() like in activities, but also we have to annotate our ViewModel as @HiltViewModel.

Ответить
@Hrit
@Hrit - 14.03.2022 10:35

I am getting this error
Execution failed for task ':app:kaptDebugKotlin'.
How do I fix it?

Ответить
@remmievail8148
@remmievail8148 - 06.02.2022 06:59

Any chance you can update this? Your tutorials are great, but there have been a number of changes and Google is horrible when it comes to teaching anything

Ответить
@abdo-ar-888
@abdo-ar-888 - 25.01.2022 20:02

Thanks for your amazing tutorials ❤

Ответить
@Kunal-jp8tn
@Kunal-jp8tn - 18.01.2022 20:02

Thank you so much for this amazing video.

Ответить
@tunahanbozkurt9516
@tunahanbozkurt9516 - 17.01.2022 04:32

You are the best !!!

Ответить
@nicolasfelipe1
@nicolasfelipe1 - 15.01.2022 21:53

the TestViewModel example does not work with lastest hill versions.

Ответить
@anggoro8178
@anggoro8178 - 27.12.2021 14:49

hey man, as always thanks for the great video, but i want to ask why don't u use koin for dependency injection? it is much much more simpler to use in my opinion

Ответить
@my_love_sanatan
@my_love_sanatan - 16.12.2021 09:15

You should be awarded

Ответить
@ajinkyajagadale1704
@ajinkyajagadale1704 - 13.12.2021 20:22

Thank you for explaining hilt in details !!!!

Ответить
@buckyass490
@buckyass490 - 12.12.2021 15:26

Wish I can like this tutorial more than one time! You saved my days, thank you!

Ответить
@lmaoiwaslikelmao1132
@lmaoiwaslikelmao1132 - 12.12.2021 02:24

I've always thought CodingInFlow and CodingWithMitch's tutorials were good, but yours are better.

Ответить
@ghulammustafa7085
@ghulammustafa7085 - 05.12.2021 19:22

you are a good teacher i love your way of teaching please keep it up and upload more tutorials.

Ответить
@GriNAME
@GriNAME - 12.11.2021 20:45

Oh man, it exactly that I was looking for! Thank you so much!

Ответить
@yvanndeme3708
@yvanndeme3708 - 29.10.2021 20:34

Thank a lot for this Tuto Phillip .

Ответить
@albertbo2178
@albertbo2178 - 25.10.2021 17:54

When I try to inject to the activity the viewmodel like this fails to compile for this reason:
Classifier 'RoutesListViewModel' does not have a companion object, and thus must be initialized here

Anyone knows how to solve this?

Ответить
@nevermore7755
@nevermore7755 - 14.10.2021 07:03

For those having trouble with ViewModel log cat:

@Module
@InstallIn(ActivityRetainedComponent ::class)
object MainModule {

// This will only live in main activity
// Cannot have @singleton that only lives as long as our activity
// Instead of @Singleton, we use activity scoped
@ActivityRetainedScoped
@Provides
@Named("String2")
// if we need to access context, say strings file, how?
// We used context as a parameter!!
// dagger hilt will also figure out which testString1 we will inject!!
fun provideTestString2(@ApplicationContext context: Context,
@Named("String1") testString1: String) =
"${context.getString(R.string.string_to_inject)} - $testString1"

}

Ответить
@mohamadrezazandieh3003
@mohamadrezazandieh3003 - 11.10.2021 15:57

the best tutorial forever :) thanks, Philipp

Ответить
@vipullal7689
@vipullal7689 - 09.10.2021 10:20

Couldn't be better explained. Thanks!

Ответить
@unistern
@unistern - 30.09.2021 04:54

nice vid. unfortunately hilt doesnt support DI in kotlin object . or do you know how to?

Ответить
@c99rahul
@c99rahul - 28.09.2021 06:14

You should use the SingletonComponent, as ApplicationComponent doesn't exist in the new Dagger anymore.

Ответить
@salamytech
@salamytech - 23.09.2021 22:28

thanks a lot, but in hilt module ApplicationComponent replaced with SingletonComponent

Ответить
@PerceptronGameplay
@PerceptronGameplay - 06.09.2021 21:56

nice

Ответить