https://kotlinlang.org
Join Slack
In compose type safe navigation, I am trying to pass a nullable data class to a screen route class, ...
n

Nikhil Parab

10 months ago
In compose type safe navigation, I am trying to pass a nullable data class to a screen route class, I am using serializableType generic fun to create typeMap and pass it to the Route class, with isNullableAllowed as true
inline fun <reified T : Any> serializableType(
    isNullableAllowed: Boolean = false,
    json: Json = Json,
) = object : NavType<T>(isNullableAllowed = isNullableAllowed) {
    override fun get(bundle: Bundle, key: String) =
        bundle.getString(key)?.let<String, T>(json::decodeFromString)

    override fun parseValue(value: String): T = json.decodeFromString(value)

    override fun serializeAsValue(value: T): String = json.encodeToString(value)

    override fun put(bundle: Bundle, key: String, value: T) {
        bundle.putString(key, json.encodeToString(value))
    }
}
but still I am getting this error,
java.lang.IllegalArgumentException: Route companyname.data.model.Route.PartValidation could not find any NavType for argument validation of type companyname.domain.model.ValidationItem? - typeMap received was {companyname.domain.model.ValidationItem (Kotlin reflection is not available)=nav_type}
n
s
  • 2
  • 2
  • 316
What dispatcher does ktor client make requests on? Does it depend on engine? I’m seeing `DarwinClien...
k

Kirill Zhukov

over 2 years ago
What dispatcher does ktor client make requests on? Does it depend on engine? I’m seeing
DarwinClientEngine
declares
Unconfined
dispatcher, but not sure this it’s actually being used for requests?
k
a
  • 2
  • 2
  • 316
I am using Coil for image loading but I am not sure why my Images are reloading when coming back to ...
s

Shakil Karim

about 4 years ago
I am using Coil for image loading but I am not sure why my Images are reloading when coming back to the previous screen.
device-2021-10-15-205546.webm
s
m
+3
  • 5
  • 15
  • 316
since `painterResource` throws exception for some drawables and we can't write try/catch in `@Compos...
f

Fabio

over 4 years ago
since
painterResource
throws exception for some drawables and we can't write try/catch in
@Composable
functions, how can I work around not crashing my app?
painterResource
calls
loadVectorResource
who calls
loadVectorResource
private fun loadVectorResource(theme: Resources.Theme, res: Resources, id: Int): ImageVector {
    @Suppress("ResourceType") val parser = res.getXml(id)
    if (parser.seekToStartTag().name != "vector") {
        throw IllegalArgumentException(errorMessage)
    }
    return loadVectorResourceInner(theme, res, parser)
}
It crashes for an image such as this
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="<http://schemas.android.com/apk/res/android>">


    <item>
        <shape android:shape="oval">
            <solid android:color="@color/colorBardeenBrand" />
        </shape>
    </item>

</layer-list>
🧵 3
f
i
c
  • 3
  • 9
  • 316
Hello K2 mode doesn't support plugin sqldelight
u

Ume Channel

11 months ago
Hello K2 mode doesn't support plugin sqldelight
u
j
  • 2
  • 4
  • 315
Why does this crash on iOS? ```Image(painter = painterResource("image.jpg"), contentDescription = nu...
s

Sergio C.

over 2 years ago
Why does this crash on iOS?
Image(painter = painterResource("image.jpg"), contentDescription = null)
It works fine on Android. Loading xml vectors also work fine on both platforms.
s
a
+6
  • 8
  • 36
  • 315
I have a `List` of `Flow`s which I combine into a single `Flow` using `combine(Iterable)` . Now I wa...
m

Mark

over 2 years ago
I have a
List
of `Flow`s which I combine into a single
Flow
using
combine(Iterable)
. Now I want to add another
Flow
to the
List
. How to handle this? Keep a reference to the combine
Job
and cancel/recreate accordingly? Combine the existing
combine
Flow
with the new
Flow
list item? Or perhaps represent the list as a
Flow
and use
runningFold
and
flatMapLatest
? Something else?
m
o
  • 2
  • 4
  • 315
Is there a way to combine `WindowInsets` with `PaddingValues` ? I need both for `contentPadding` in ...
t

Tgo1014

over 2 years ago
Is there a way to combine
WindowInsets
with
PaddingValues
? I need both for
contentPadding
in a
LazyColumn
t
s
+3
  • 5
  • 11
  • 315
TouchDelegate in Compose It has probably been asked before, at least on SO. However, since compose e...
e

enighma

about 3 years ago
TouchDelegate in Compose It has probably been asked before, at least on SO. However, since compose evolve fairly fast I thought I'd ask if there's an API to do what Touch delegate does? as in a modifier property. The alternative is ofc to delegate it my self, but wanted to check before I did that.
e
t
z
  • 3
  • 9
  • 315
I'm trying to run the packageReleaseDeb task but it fails with this error `Error: Invalid or unsuppo...
z

zt

about 3 years ago
I'm trying to run the packageReleaseDeb task but it fails with this error
Error: Invalid or unsupported type: [deb]
. Same with rpm. I'm developing on linux so shouldn't it be working?
z
e
  • 2
  • 17
  • 315
Previous222223224Next

kotlinlang

A modern programming language that makes developers happier.

Powered by