maui-platform-invoke
Installation
SKILL.md
Platform Invoke — Gotchas & Best Practices
Decision Framework
| Scenario | Approach |
|---|---|
| 1–5 lines, one-off check | #if ANDROID conditional compilation |
| Service with logic, testable | Partial classes in Platforms/ folders |
| Swappable implementations, mocking | Interface + DI registration |
Team prefers *.android.cs naming |
Custom file patterns in .csproj |
Default choice: partial classes + interface + DI. Only use #if for trivial inline checks.