https://kotlinlang.org
Join Slack
Hello everyone. I am trying to change a variable in a singleton and the IDE displayed me the followi...
f

Francis Mariano

over 3 years ago
Hello everyone. I am trying to change a variable in a singleton and the IDE displayed me the following message:
With old Native GC, variable in singleton without @ThreadLocal can't be changed after initialization
. Are there a new Native GC ????
f
m
k
  • 3
  • 3
  • 1694
I wanted to add shadow to a composable. Shadow should be only applied to the top. (Not required for ...
w

wintersoldier

almost 3 years ago
I wanted to add shadow to a composable. Shadow should be only applied to the top. (Not required for left or right). Is there some way to achieve this. Code snippet I already tried,
Box(
  modifier = Modifier
    .background(Color.Yellow)
    .shadow(
      elevation = 2.dp,
    ),
) {
content()
}
w
o
  • 2
  • 12
  • 1682
Anyone have experience with using Mapbox with Kotlin Multiplatform?
j

james

over 4 years ago
Anyone have experience with using Mapbox with Kotlin Multiplatform?
j
d
+2
  • 4
  • 7
  • 1681
Is there any chart library available for compose multiplatform?
j

jamshedalamqaderi

about 2 years ago
Is there any chart library available for compose multiplatform?
j
p
m
  • 3
  • 5
  • 1677
`Exceeded max line length (120) (cannot be auto-corrected) (max-line-length)` Why can't line length ...
j

jeff

over 3 years ago
Exceeded max line length (120) (cannot be auto-corrected) (max-line-length)
Why can't line length be auto-corrected? IntelliJ auto-corrects it just fine. Any alternative settings or different tools that can do better?
j
s
  • 2
  • 1
  • 1654
I'm getting crashes when running Kotlin Multiplatform iOS apps using new XCode 15 Beta + iOS 17 Simu...
j

John O'Reilly

over 2 years ago
I'm getting crashes when running Kotlin Multiplatform iOS apps using new XCode 15 Beta + iOS 17 Simulator.....seems to be in Ktor code. I'll dig a bit deeper but just in case anyone else seeing same thing....
➕ 2
j
s
a
  • 3
  • 3
  • 1652
Hey I’m having issues mocking an extension property, how can one do it? Suppose I have `class MyServ...
a

André Martins

over 3 years ago
Hey I’m having issues mocking an extension property, how can one do it? Suppose I have
class MyService { … }
and an extension property like
val MyService.myProp: String
    get() = "value"
when doing
mockk<MyService> {
    every { myProp } returns "otherValue"
}
it throws a
MockkException
msg:
Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock
a
  • 1
  • 5
  • 1651
How to correctly store a list in a mutablestate remember variable? I tried with `val imagesList by r...
p

Pablo

almost 2 years ago
How to correctly store a list in a mutablestate remember variable? I tried with
val imagesList by remember *{* _mutableStateListOf_<ImageModel>()*}*
but it gives this error
Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
If I replace
by remember
with
= remember
the error dissapears and I dont understand why. Also, the guides says
by remember
is the correct option so I whould like to understand how to be able to use
by remember
with this list. Another problem I found is that even using
=
instead of
by
, I'm not able to init the variable with a list.
remember *{* _mutableStateListOf_<ImageModel>(ImageModelProvider.imageModelList)*}*
gives this error:
Type mismatch. Required: ImageModel Found:List<ImageModel>
p
e
z
  • 3
  • 8
  • 1648
easiest way to cast a mutable list into a list?
m

mgrazianodecastro

almost 3 years ago
easiest way to cast a mutable list into a list?
m
h
+4
  • 6
  • 19
  • 1623
Using the new `BasicTextField2` API, when listening to its changes through its `textAsFlow()`, is th...
s

sindrenm

over 1 year ago
Using the new
BasicTextField2
API, when listening to its changes through its
textAsFlow()
, is there a way to know if a text was added programmatically through
edit {}
vs. manually from a user? I'm thinking something like this, but due to the asynchronous nature of it all, that doesn't quite cut it:
val textFieldState = TextFieldState("")
var isSettingProgrammatically = false

launch {
  textFieldState.textAsFlow()
    .dropWhile { isSettingProgrammatically }
    .collect { println("change: $it") }
}

launch {
  delay(2.seconds)

  isSettingProgrammatically = true
  textFieldState.edit { replace(0, length, "value" }
  isSettingProgrammatically = false
}
where the
"value"
from the second
launch
should not be printed from the text flow collection.
s
s
+2
  • 4
  • 45
  • 1621
Previous161718Next

kotlinlang

A modern programming language that makes developers happier.

Powered by