What are the common platform classes in Kotlin?

I would like to use Kotlin to determine the interfaces between client and server.

Currently, Kotlin can be used in three platforms: Java, Android, Web (JS).

What Kotlin built-in class classes can be used on all of these platforms?

I would expect some general library dependency between kotlin-stdlib and kotlin-stdlib-js , but could not find it.

On the other hand, I was able to create the following interface that can be used on all three platforms:

interface SomeApi {
    fun update(params: Collection<String>)
}

So, how can I determine what can be used on all platforms besides Collection?

+4
source share
1 answer

You should be able to use all the classes in kotlin-runtimeand kotlin-stdlibespecially everything that is in the stdlib / common folder in the Github repo.

Multi-platform projects are currently under development, and once they are released, it should be easier to write platform-independent code.

+5
source

Source: https://habr.com/ru/post/1679220/


All Articles