I just tried updating, but I cant get Resource<A>....
# arrow
m
I just tried updating, but I cant get ResourceA.releaseCase working... This snippet was working before in 1.2.4 I saw Resource.kt was more or less completely rewritten but from the signatures I see no reason why this should not work. Nevertheless the IDE claims it doesn't know resourceCase 😕
y
You need to be inside a
ResourceScope
to use that extension, so surround your code with
resourceScope
. Even better, just use
install
or
onRelease
or any of the other simpler methods
m
Ahh .. I see! we have some similar situation as in the example from the docs: https://arrow-kt.io/learn/coroutines/resource-safety/#using-resource So I fixed it by moving the release block inside the resource block and used onRelease:
Copy code
resource {
	onRelease { _, _ -> 

    }
}