Skip to content

This project demonstrate two different approaches to dependency injection using https://zacsweers.github.io/metro/

Notifications You must be signed in to change notification settings

lucasmacielc/metro-sample

Repository files navigation

Metro Samples - Dependency Injection Patterns

This project demonstrates two different approaches to dependency injection using Metro.

Project Structure

metrosample/
├── memberinjection/          # Member Injection PoC
│   ├── app/                  # Application module
│   ├── core-di/              # Core DI infrastructure
│   └── feature/              # Feature module
│
└── fullconstructorinjection/     # Constructor Injection PoC
    ├── app/                  # Application module
    ├── core-di/              # Core DI infrastructure
    └── feature/              # Feature module

PoC Descriptions

Member Injection PoC

  • Package: memberinjection/*
  • Demonstrates member injection pattern with @Inject lateinit var
  • Fragment uses member injection to receive dependencies
  • Allows ActivityScoped dependencies

Constructor Injection PoC

  • Package: fullconstructorinjection/*
  • Demonstrates constructor injection pattern
  • Allows ActivityScoped dependencies

Running the Samples

Both apps can be installed simultaneously on the same device due to different application IDs.

Member Injection

./gradlew :memberinjection:app:installDebug

Constructor Injection

./gradlew :fullconstructorinjection:app:installDebug

About

This project demonstrate two different approaches to dependency injection using https://zacsweers.github.io/metro/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages