Inject Platform Implementations
Provide the right actual via Koin or factories.
Who Supplies the Real Thing
An interface defines a capability, but something must hand shared code the real platform implementation. That wiring is dependency injection.
Avoid new in Shared Code
Shared logic should not construct platform classes itself. Instead it receives the implementation from outside, keeping it decoupled and testable.
All lessons in this course
- Design a Capability Interface
- expect/actual for Device Info
- File System & Paths per Platform
- Inject Platform Implementations