Is there a way to have a receiver lambda as a map ...
# announcements
p
Is there a way to have a receiver lambda as a map value? Trying to do something like this:
Copy code
val block: CallBuilder.() -> Unit = {
  before {
    +LogRequest()
  }
}
val envSpecific: Map<Environment, CallBuilder.() -> Unit> =
    mapOf(Environment.PRODUCTION to block)
But, when I inline it, to
Copy code
val envSpecific: Map<Environment, CallBuilder.() -> Unit> =
    mapOf(Environment.PRODUCTION to {
      before {
        +LogRequest()
      }
    })
it appears to not be valid syntax. Is there any way to have inlined receiver lambdas?