Skip to content

Commit ad8ad3d

Browse files
committed
Add documentation to migrate from Dagger/Anvil to Metro
1 parent e88743b commit ad8ad3d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/migration_to_metro.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Migration to Metro
2+
3+
The dependency injection library is now [Metro](https://zacsweers.github.io/metro/latest/). It replaces both Dagger and Anvil.
4+
5+
Migration of the current Element X code has been performed in https://github.com/element-hq/element-x-android/pull/5253.
6+
7+
To migrate other existing code you will need to:
8+
9+
- replace `setupAnvil()` with `setupDependencyInjection()` in your `build.gradle.kts` files
10+
- replace the Dagger and Anvil imports with Metro ones
11+
- move the `@Inject` apply to the constructor to the class itself (only applicable if there is only one primary constructor
12+
- replace `@AssistedInject` with `@Inject`
13+
- replace `@Module` with `@BindingContainer`
14+
15+
This should help to migrate your existing code.

0 commit comments

Comments
 (0)