Created
May 2, 2023 18:25
-
-
Save saqib-github-commits/a130b84f1e06ce2a220054bcd40733cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
inline fun rememberCoroutineScope( | |
getContext: @DisallowComposableCalls () -> CoroutineContext = { EmptyCoroutineContext } | |
): CoroutineScope { | |
val composer = currentComposer | |
val wrapper = remember { | |
CompositionScopedCoroutineScopeCanceller( | |
createCompositionCoroutineScope(getContext(), composer) | |
) | |
} | |
return wrapper.coroutineScope | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment