Hi lens-experts. How would I define an EnvironmentKey which may hold a subset of predefined enum values?
Fabian Braun
01/15/2021, 2:45 PM
code snippet leading to the compiler err:
Copy code
val enumTypes = EnvironmentKey.enum<EnumType>().multi.defaulted(
"ENUM_TYPES",
emptyList<EnumType>()
)
d
dave
01/15/2021, 7:55 PM
this seems to work:
Copy code
enum class Bob {
foo, bar
}
fun main() {
val enumTypes = EnvironmentKey.enum<Environment, Bob>().multi.defaulted(
"BOB",
emptyList()
)
println(enumTypes(Environment.from("BOB" to "foo")))
}