File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed
Example/composeApp/src/commonMain/kotlin/org/example/project Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,6 @@ import ui.SnifferIndicator
88@Composable
99@Preview
1010fun App () {
11- ContextScope {
12- MainPanel ()
13- }
14-
11+ MainPanel ()
1512 SnifferIndicator ()
1613}
Original file line number Diff line number Diff line change 11package org.example.project
22
3- import androidx.compose.runtime.Composable
4- import androidx.compose.runtime.CompositionLocalProvider
5- import androidx.compose.runtime.remember
63import androidx.compose.runtime.staticCompositionLocalOf
74import io.ktor.client.*
85import io.ktor.client.plugins.contentnegotiation.*
96import io.ktor.serialization.kotlinx.json.*
107import kotlinx.serialization.json.Json
118import util.ktor.SnifferPlugin
129
13- val LocalHttpClient = staticCompositionLocalOf<HttpClient > { error(" Not provider" ) }
14-
15- @Composable
16- fun ContextScope (
17- content : @Composable () -> Unit
18- ) {
19- val httpClient = remember { defaultHttpClient() }
20-
21- CompositionLocalProvider (LocalHttpClient provides httpClient) {
22- content.invoke()
23- }
24- }
10+ val LocalHttpClient = staticCompositionLocalOf { defaultHttpClient() }
2511
2612fun defaultHttpClient (): HttpClient {
2713 return HttpClient {
You can’t perform that action at this time.
0 commit comments