Replies: 6 comments 8 replies
-
|
Support Kotlin's stdlib Lazy - Done ✅ |
Beta Was this translation helpful? Give feedback.
-
|
Edit: This is implemented but behind an opt-in flag as generating top-level declarations is not yet supported in incremental compilation. It is also implemented differently. See https://zacsweers.github.io/metro/injection-types/#top-level-function-injection Support top-level function injection. aka support the magic composable function entry point like kotlin-inject supports typealias Home = @Composable () -> Unit
@Inject
@Composable
fun Home(repo: HomeRepository) {
// ...
}
@Component
abstract class ApplicationComponent() {
abstract val home: Home
} |
Beta Was this translation helpful? Give feedback.
-
|
Support optional bindings via default values. This would be an alternative to Dagger's Some open questions about this:
|
Beta Was this translation helpful? Give feedback.
-
|
Implicitly create component factory types when none are defined? Can save boilerplate, but relies a lot on FIR magic + IDE integration. |
Beta Was this translation helpful? Give feedback.
-
|
Something I've been thinking of for improvements to a function injection api would be automatically generating typealiases for functions annotated with An additional improvement to this api is allowing users to bind a specific typealias to a function, while it's not possible to reference a typealias in the properties of building an annotation the way @Inject <-- Automatically generates: typealias MyAutoAlias = () -> Int
fun MyAutoAlias(): Int
typealias MyManualAlias = (MyAutoAlias) -> String
@BindAlias<MyManualAlias>
fun MyManualFunctionWithADifferentName(myAutoAlias: MyAutoAlias): String
@Component
interface ApplicationComponent {
abstract val myAutoAlias: MyAutoAlias
abstract val myManualAlias: MyManualAlias
} |
Beta Was this translation helpful? Give feedback.
-
|
Typealiases do not work as implicit qualifiers, according to the doc, and I'm good with this. But what about explicit typealias qualifiers? Could this be supported: @Qualifier
typealias UserId = String |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a discussion for Kotlin language features to natively embrace. Try to keep threads specific to their topic idea
Beta Was this translation helpful? Give feedback.
All reactions