jean
09/26/2025, 6:56 AMcontext method :
val myDependency = Box<String>()
context(myDependency) {
doWork()
}
doWork has a red wave underline saying “No context argument for ‘BoxString’ found.” If I replace context with with the linting goes away. But I can compile my program without issues while using context , it’s just in the IDE. Any ideas how to fix that?Sergey Dmitriev
09/26/2025, 7:00 AMcontext? Is it context receivers/parameters?jean
09/26/2025, 7:03 AMfun test() {
val myDependency = Box<String>()
context(myDependency) {
doWork()
}
}
context(myDependency: Box<String>)
fun doWork() {
// do stuff with myDependency
}dave08
09/28/2025, 4:08 PMfun test() {
val myDependency = Box<String>()
with(myDependency) { // with, not context here
doWork()
}
}jean
09/28/2025, 4:22 PMwith works fine as long as I only need one dependency, but one does need context for more than onejean
09/28/2025, 4:24 PMGdesantos
10/27/2025, 3:25 PMjean
10/29/2025, 9:03 AM