Рет қаралды 8,246
What is Dependency Injection in Android using Kotlin?
In software engineering, dependency injection is a design pattern in which an object or function receives other objects or functions that it depends on. A form of inversion of control, dependency injection aims to separate the concerns of constructing objects and using them, leading to loosely coupled programs.
Dependency:-
--------------------------------------------------------------------------------------------------
Build.Gradle.app
--------------------------------------------------------------------------------------------------
// dagger Hilt
implementation 'com.google.dagger:hilt-android:2.38.1'
kapt 'com.google.dagger:hilt-compiler:2.38.1'
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'com.google.gms.google-services'
}
--------------------------------------------------------------------------------------------------
Build.Gradle.project
--------------------------------------------------------------------------------------------------
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
classpath 'com.google.gms:google-services:4.3.14'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Vlog Channel Link:-
/ @jenilvaghanivlogs2139
✅---------CONNECT WITH US --------------
👉 Instagram:- / your_developer_here
👉 Mail:- yourdeveleoperhere001@gmail.com
👉 GitHub:- github.com/jen...
♥️ if you have any queries about this video then contact me on the following account
Thank you