diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt index 48b22b4f431..e2ad31a4af3 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt @@ -45,11 +45,19 @@ fun BroadcastChannel.asStateFlow( replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize ): StateFlow = asStateFlow(null, scope, replayCacheSize) -fun broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int = Channel.BUFFERED, replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize) = BroadcastChannel( +fun broadcastStateFlow( + initial: T, scope: CoroutineScope, + channelSize: Int = Channel.BUFFERED, + replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize +) = BroadcastChannel( channelSize ).let { it to it.asStateFlow(initial, scope, replayCacheSize) } -fun broadcastStateFlow(scope: CoroutineScope, channelSize: Int = Channel.BUFFERED, replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize) = broadcastStateFlow(null, scope, channelSize, replayCacheSize) +fun broadcastStateFlow( + scope: CoroutineScope, + channelSize: Int = Channel.BUFFERED, + replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize +) = broadcastStateFlow(null, scope, channelSize, replayCacheSize)