I have an extension function declared within a `Fr...
# getting-started
m
I have an extension function declared within a
Fragment
subclass:
Copy code
inline fun <T> Flow<T>.collectInViewScope(crossinline action: suspend (value: T) -> Unit) {
    viewLifecycleOwner.lifecycleScope.launch { 
        collect(action)
    }
}
But is there a way to declare this outside of the class (so it can be used from any
Fragment
subclass, without having to pass in the
Fragment
instance as an arg? A kind of extension function with added context of the call site. One could imagine
inline <http://Fragment.fun|Fragment.fun> <T> Flow<T>.collectInViewScope(…)
🚫 2
m
No, i'ts not possible to have multiple receivers. https://github.com/Kotlin/KEEP/pull/176
👍 1