however, you can access Firebase via the REST API ...
# getting-started
m
however, you can access Firebase via the REST API (https://firebase.google.com/docs/firestore/use-rest-api), and make the access by a Http Client like ktor
j
So the setup will be like this: my common will be responsible for writing into my firebase database thru rest API? Am i right?
m
yes, all the access to Firebase will be made by your kotlin multiplatform module, via REST API
this way, you can have the access to firebase on one place and shared by your Apps
or.....
you can implement the access to Firebase on the iOS and Android common code source folders on kotlin mutiplatform module
I mean, you can to duplicate the code to access Firebase using the platform specific SDKs
but, I don't recommend to do this way (code duplicated 😩)
j
Thank you very much for your insight! Will experiment will all your suggestions Thanks a lot
👍
im having a difficulty importing ktor in my shared library
m
Copy code
commonMain {
    dependencies {
        implementation kotlin('stdlib-common')

        implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
        implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"

        implementation "io.ktor:ktor-client-core:$ktor_version"
        implementation "io.ktor:ktor-client-json:$ktor_version"
        implementation "io.ktor:ktor-client-logging:$ktor_version"
        implementation "io.ktor:ktor-client-serialization:$ktor_version"
    }
}
Copy code
def ktor_version="1.2.5"
did you put your dependencies like this ?
j
Yes
It says unknown property 'serialization_version'
coroutines_version
and ktor
m
well you can define it on the module's
build.gradle
file like:
def serialization_version="0.13.0"
but I like to do it on the project's
gradle.properties
like:
Copy code
# kotlin
kotlin_version=1.3.50
kotlin.code.style=official
#kotlin.incremental.multiplatform=true

# kotlin libraries
serialization_version=0.13.0
coroutines_version=1.3.2
ktor_version=1.2.5
and then use it on all
build.gradle
file on my project