@@ -13,7 +13,6 @@ import androidx.lifecycle.lifecycleScope
1313import androidx.lifecycle.repeatOnLifecycle
1414import androidx.recyclerview.widget.RecyclerView
1515import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
16- import kotlinx.coroutines.ExperimentalCoroutinesApi
1716import kotlinx.coroutines.Job
1817import kotlinx.coroutines.channels.awaitClose
1918import kotlinx.coroutines.flow.Flow
@@ -22,9 +21,11 @@ import kotlinx.coroutines.flow.collect
2221import kotlinx.coroutines.launch
2322
2423fun interface FlowTransformer <I , O > {
24+ @CheckResult
2525 fun transform (input : Flow <I >): Flow <O >
2626}
2727
28+ @CheckResult
2829@Suppress(" NOTHING_TO_INLINE" )
2930inline fun <I , O > Flow<I>.pipe (transformer : FlowTransformer <I , O >) =
3031 transformer.transform(this )
@@ -35,7 +36,6 @@ fun Context.toast(text: CharSequence) = Toast.makeText(this, text, Toast.LENGTH_
3536
3637fun Fragment.toast (text : CharSequence ) = requireContext().toast(text)
3738
38- @OptIn(ExperimentalCoroutinesApi ::class )
3939@CheckResult
4040fun SwipeRefreshLayout.refreshes (): Flow <Unit > {
4141 return callbackFlow {
@@ -44,7 +44,6 @@ fun SwipeRefreshLayout.refreshes(): Flow<Unit> {
4444 }
4545}
4646
47- @OptIn(ExperimentalCoroutinesApi ::class )
4847@CheckResult
4948fun View.clicks (): Flow <View > {
5049 return callbackFlow {
@@ -55,7 +54,7 @@ fun View.clicks(): Flow<View> {
5554
5655data class RecyclerViewScrollEvent (val view : RecyclerView , val dx : Int , val dy : Int )
5756
58- @OptIn( ExperimentalCoroutinesApi :: class )
57+ @CheckResult
5958fun RecyclerView.scrollEvents (): Flow <RecyclerViewScrollEvent > {
6059 return callbackFlow {
6160 val listener = object : RecyclerView .OnScrollListener () {
@@ -74,7 +73,7 @@ fun RecyclerView.scrollEvents(): Flow<RecyclerViewScrollEvent> {
7473 }
7574}
7675
77- @OptIn( ExperimentalCoroutinesApi :: class )
76+ @CheckResult
7877fun ViewGroup.detaches (): Flow <Unit > {
7978 return callbackFlow {
8079 val listener = object : View .OnAttachStateChangeListener {
0 commit comments