https://kotlinlang.org
Join Slack
SQLDelight/KMP : is there a simple/clean way to catch a specific SQL exception in the commonMain cod...
g

glureau

almost 3 years ago
SQLDelight/KMP : is there a simple/clean way to catch a specific SQL exception in the commonMain code? (I feel like I have to create my own SqlExceptionMapper with expect/actual but hope there's already something available.)
g
s
j
  • 3
  • 4
  • 317
Getting following error when building iOS shared module with molecule dependency ```e: Module "app.c...
f

Filip Wiesner

almost 3 years ago
Getting following error when building iOS shared module with molecule dependency
e: Module "app.cash.molecule:molecule-runtime (app.cash.molecule:molecule-runtime-iosarm64)" has a reference to symbol androidx.compose.runtime/Composition.setContent|-2259719813581705387[0]. Neither the module itself nor its dependencies contain such declaration.
What am I doing wrong? I am using Kotlin 1.8.0.
f
j
+3
  • 5
  • 12
  • 317
Jetpack Compose stability in a KMM project I’m currently writing a KMM application where I use Jetp...
s

svenjacobs

about 3 years ago
Jetpack Compose stability in a KMM project I’m currently writing a KMM application where I use Jetpack Compose on the Android side. Of course most of the business logic, the ViewModels and data classes are placed in the
shared
module under
commonMain
. Now I have the problem that the Compose compiler determines all of my (immutable) data classes as unstable because they are placed in a different module. I cannot add the Compose runtime dependency to
commonMain
because this is not a multiplatform dependency and the project just won’t compile when doing so. Of course I could add wrapper classes like described in the linked article and use them only for Android, but this would mean I would have to start using generic types in my ViewModels extensively to ensure that I still share most of the business logic. Isn’t there another way of telling the Compose compiler which classes are actually immutable/stable, maybe via command line arguments or a configuration similar to ProGuard/R8? I’m using version
1.3.0
of Compose compiler.
s
j
+3
  • 5
  • 12
  • 317
How can you apply the serialization plugin in the buildSrc? This results into an error: ```plugins {...
h

hfhbd

over 3 years ago
How can you apply the serialization plugin in the buildSrc? This results into an error:
plugins {
    `kotlin-dsl`
    kotlin("plugin.serialization") version "1.7.0"
}

repositories {
    gradlePluginPortal()
    mavenCentral()
}
✅ 1
h
e
+3
  • 5
  • 9
  • 317
is there a straightforward way to track the decay of velocity when scrolling LazyColumn? what I’d li...
j

james

over 3 years ago
is there a straightforward way to track the decay of velocity when scrolling LazyColumn? what I’d like is a way to track the decay as follows when I fling on my LazyColumn and it starts scrolling. let’s say the total scroll time for this example will take 2500ms: • at 0ms elapsed, the velocity would be 100 • at 500ms elapsed, the velocity would be 75 • at 1000ms elapsed, the velocity would be 25 • at 2000ms elapsed, the velocity would be 10 • at 2500ms elapsed, the velocity would be 0 (all example data of course, I’m just trying to illustrate the value I’d like to be able to track)
j
c
b
  • 3
  • 17
  • 317
Is it possible to write a data driven test using StringSpec, wrapping it in a context? So far I’ve o...
m

Matteo Mirk

almost 4 years ago
Is it possible to write a data driven test using StringSpec, wrapping it in a context? So far I’ve only been able to make it work only like this:
class PriceSpec : StringSpec({
    withData(
        nameFn = { "goods=${it.goods}" },
        // data rows
    ) { (goods, total) ->
        price(goods) shouldBe total
    }

    "test incremental" {
        ...
    }
})
Originally there were 2 tests, then I transformed the first into a ddt, but I lost its name wrapping the generated cases. I would like to give a name to the ddt, but If I put the withData() declaration inside a string block it’ll fail at runtime, and if I wrap it with a context(“name”) as shown in the docs, only the second test will be executed. What am I doing wrong?
m
s
  • 2
  • 5
  • 317
Hey folks, I want to use Firestore and Cloud Storage from my KMM app. What is the best approach now...
m

Martin Rajniak

about 4 years ago
Hey folks, I want to use Firestore and Cloud Storage from my KMM app. What is the best approach nowadays. I have seen https://github.com/gitliveapp/firebase-kotlin-sdk/ ( that seem to wrap native Firebase libraries ). It is missing Cloud Storage support but from the look of other implementations, it seems like a not that big effort. My question, isn't it better to use REST API directly from shared code?
m
t
  • 2
  • 4
  • 317
Hey, I have a JSON response and i need to filter that data in a list. In every JSONObject there are ...
v

Vivek Modi

over 4 years ago
Hey, I have a JSON response and i need to filter that data in a list. In every JSONObject there are 3 categories in which only one category holds data.
data class CategoryResponse(
        val item: List<CategoryItem>
)

data class CategoryItem(
        val id: Int,
        val Category1: List<ItemOptions>? = null,
        val Category2: List<ItemOptions>? = null,
        val Category3: List<ItemOptions>? = null
)

data class ItemOptions(
        val name: String? = null,
        val url: String? = null
)
I have an enum class, which has 4 enum types
enum class CategoryType(val name :String){
  ALL("ALL"),
  Category1("Category1"),
  Category2("Category2"),
  Category3("Category3");
}
There is a category named ALL, so i need the list of all the data but I don't want any null values, and still want the data that other categories hold. Example - the list consist of 5 elements  Desired output: ALL : list-> [id : 1 , category1 : ”..”] , [id : 2 ,category2 : “..”] , [id : 3 ,category2 : ”..”] , [id : 4 ,category1 : “..”] , [id : 5 ,category3: “.."]    CATEGORY2: list -> [id : 2 , category2 : “..”] , [id : 3 , category2 : “..”] (this list may or may not consist of more than 5 elements) is there any way that this list won’t occupy a lot of memory, or duplicate the objects and could be more efficient.?
v
j
  • 2
  • 8
  • 317
kmath getting started and how to use examples. With kmath there seems to be very little documentatio...
a

alex cole

about 5 years ago
kmath getting started and how to use examples. With kmath there seems to be very little documentation for getting started and transitioning from numpy to kmath. Is there any guide for this such as how to do a linspace function?
a
a
b
  • 3
  • 11
  • 317
After updating to 1.8.0-rc01 package androidx.compose.material.icons is no longer available. Is it m...
p

PHondogo

7 months ago
After updating to 1.8.0-rc01 package androidx.compose.material.icons is no longer available. Is it moved somewhere or removed completely?
👍 1
p
l
+4
  • 6
  • 7
  • 316
Previous221222223Next

kotlinlang

A modern programming language that makes developers happier.

Powered by