Does anyone use coroutines inside there recyclervi...
# android
r
Does anyone use coroutines inside there recyclerview? if so how do you define the lifecycle of scope?
j
Why do you want to use coroutines inside your adapter class? Could you use DI for the scope?
m
create scope when you create adapter and cancel it on
onDetachedFromRecyclerView
. don't use DI if you don't need to test something
l
@rkeazor This project by one of AndroidX leads implements it supposedly properly: https://github.com/yigit/suspend-bind
@Ian Lake Any reason this would be a bad idea, apart from possible GC overhead because of allocation on each bind?
r
@louiscad that first reason seemed bad enough lol. will look