[{"data":1,"prerenderedAt":36},["ShallowReactive",2],{"projects/GitLiveApp/firebase-kotlin-sdk":3,"projects/GitLiveApp/firebase-kotlin-sdk/:README":16},{"name":4,"platforms":5,"content":7,"related":8,"blacklist":9,"description":10,"fork":9,"stars":11,"last_updated":12,"last_fetched":13,"id":14,"ref":15},"Firebase Kotlin SDK (unofficial)",{"android":6,"ios":6,"web":6},true,"README.md",{"firebase/firebase-android-sdk":6,"firebase/firebase-ios-sdk":6,"firebase/firebase-js-sdk":6},false,"A Kotlin-first SDK for Firebase",1668,["Date","2026-04-25T12:39:03.000Z"],["Date","2026-04-26T01:40:16.554Z"],"gitliveapp::firebase-kotlin-sdk","[object Object]",{"header":17,"sections":20,"id":14,"ref":15},{"name":18,"content":19},"Firebase Kotlin SDK  ","\u003Cimg align=\"left\" width=\"75px\" src=\"https://avatars2.githubusercontent.com/u/42865805?s=200&amp;v=4\">\u003Cb>Built and maintained with &#x1F9E1; by \u003Ca href=\"https://git.live\">GitLive\u003C/a>\u003C/b>\u003Cbr>\u003Ci>Development teams merge faster with GitLive\u003C/i>\u003Cbr>\u003Cbr>\u003Cbr>\u003Ca href=\"https://firebase.google.com/docs/reference/kotlin/packages\">Firebase Android SDK Kotlin Extensions\u003C/a>\u003Cstrong>iOS\u003C/strong>\u003Cstrong>Android\u003C/strong>\u003Cstrong>Desktop\u003C/strong>\u003Cstrong>Web\u003C/strong>\u003Ca href=\"https://www.jetbrains.com/lp/compose-multiplatform/\">Compose Multiplatform\u003C/a>\u003Cp>\u003C/p>",[21,26,31],{"name":22,"content":23,"id":24,"ref":25},"Available libraries","\u003Cp>The following libraries are available for the various Firebase products.\u003C/p>\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Service or Product\u003C/th>\n\u003Cth style=\"text-align:left\">Gradle Dependency\u003C/th>\n\u003Cth style=\"text-align:left\">API Coverage\u003C/th>\n\u003C/tr>\n\u003C/thead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/analytics\">Analytics\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-analytics/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-analytics:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-auth/src/commonmain/kotlin/dev/gitlive/firebase/auth/auth.kt\">\u003Cimg src=\"https://img.shields.io/badge/-80%25-green?style=flat-square\" alt=\"80%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/auth\">Authentication\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-auth/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-auth:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-auth/src/commonmain/kotlin/dev/gitlive/firebase/auth/auth.kt\">\u003Cimg src=\"https://img.shields.io/badge/-80%25-green?style=flat-square\" alt=\"80%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/database\">Realtime Database\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-database/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-database:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-database/src/commonmain/kotlin/dev/gitlive/firebase/database/database.kt\">\u003Cimg src=\"https://img.shields.io/badge/-70%25-orange?style=flat-square\" alt=\"70%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/firestore\">Cloud Firestore\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-firestore/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-firestore:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-firestore/src/commonmain/kotlin/dev/gitlive/firebase/firestore/firestore.kt\">\u003Cimg src=\"https://img.shields.io/badge/-60%25-orange?style=flat-square\" alt=\"60%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/functions\">Cloud Functions\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-functions/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-functions:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-functions/src/commonmain/kotlin/dev/gitlive/firebase/functions/functions.kt\">\u003Cimg src=\"https://img.shields.io/badge/-80%25-green?style=flat-square\" alt=\"80%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/cloud-messaging\">Cloud Messaging\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-messaging/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-messaging:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-messaging/src/commonmain/kotlin/dev/gitlive/firebase/messaging/messaging.kt\">\u003Cimg src=\"https://img.shields.io/badge/-10%25-orange?style=flat-square\" alt=\"1%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/storage\">Cloud Storage\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-storage/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-storage:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-storage/src/commonmain/kotlin/dev/gitlive/firebase/storage/storage.kt\">\u003Cimg src=\"https://img.shields.io/badge/-40%25-orange?style=flat-square\" alt=\"40%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/projects/manage-installations\">Installations\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-installations/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-installations:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-installations/src/commonmain/kotlin/dev/gitlive/firebase/installations/installations.kt\">\u003Cimg src=\"https://img.shields.io/badge/-90%25-green?style=flat-square\" alt=\"90%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/remote-config\">Remote Config\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-config/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-config:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-config/src/commonmain/kotlin/dev/gitlive/firebase/remoteconfig/firebaseremoteconfig.kt\">\u003Cimg src=\"https://img.shields.io/badge/-20%25-orange?style=flat-square\" alt=\"20%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/perf-mon\">Performance\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-perf/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-perf:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-perf/src/commonmain/kotlin/dev/gitlive/firebase/perf/performance.kt\">\u003Cimg src=\"https://img.shields.io/badge/-10%25-orange?style=flat-square\" alt=\"1%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003Ctr>\n\u003Ctd>\u003Ca href=\"https://firebase.google.com/docs/crashlytics\">Crashlytics\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/2.4.0/pom\">\u003Ccode>dev.gitlive:firebase-crashlytics:2.4.0\u003C/code>\u003C/a>\u003C/td>\n\u003Ctd style=\"text-align:left\">\u003Ca href=\"https://github.com/gitliveapp/firebase-kotlin-sdk/tree/master/firebase-crashlytics/src/commonmain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt\">\u003Cimg src=\"https://img.shields.io/badge/-10%25-orange?style=flat-square\" alt=\"80%\" class=\"img-badge\">\u003C/a>\u003C/td>\n\u003C/tr>\n\u003C/tbody>\n\u003C/table>\u003Cp>Is the Firebase library or API you need missing? \u003Ca href=\"https://github.com/GitLiveApp/firebase-kotlin-sdk/issues/new?labels=API+coverage&amp;template=increase-api-coverage.md&amp;title=Add+%5Bclass+name%5D.%5Bfunction+name%5D+to+%5Blibrary+name%5D+for+%5Bplatform+names%5D\">Create an issue\u003C/a> to request additional API coverage or be awesome and \u003Ca href=\"https://github.com/GitLiveApp/firebase-kotlin-sdk/fork\">submit a PR\u003C/a>\u003C/p>","available_libraries","#available_libraries",{"name":27,"content":28,"id":29,"ref":30},"Kotlin-first design","\u003Cp>Unlike the Kotlin Extensions for the Firebase Android SDK this project does not extend a Java based SDK so we get the full power of Kotlin including coroutines and serialization!\u003C/p>\u003Ch3>\u003Ca href=\"https://kotlinlang.org/docs/tutorials/coroutines/async-programming.html#coroutines\">Suspending functions\u003C/a>\u003C/h3>\u003Cp>Asynchronous operations that return a single or no value are represented by suspending functions in the SDK instead of callbacks, listeners or OS specific types such as \u003Ca href=\"https://developer.android.com/reference/com/google/android/play/core/tasks/Task\">Task\u003C/a>, for example:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">suspend fun signInWithCustomToken(token: String): AuthResult\n\u003C/code>\u003C/pre>\u003Cp>It is important to remember that unlike a callback based API, waiting for suspending functions to complete is implicit and so if you don&apos;t want to wait for the result you can \u003Ccode>launch\u003C/code> a new coroutine:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">//TODO don&apos;t use GlobalScope\nGlobalScope.launch {\n  Firebase.auth.signOut()\n}\n\u003C/code>\u003C/pre>\u003Ch3>\u003Ca href=\"https://kotlinlang.org/docs/reference/coroutines/flow.html\">Flows\u003C/a>\u003C/h3>\u003Cp>Asynchronous streams of values are represented by Flows in the SDK instead of repeatedly invoked callbacks or listeners, for example:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">val snapshots: Flow&lt;DocumentSnapshot&gt;\n\u003C/code>\u003C/pre>\u003Cp>The flows are cold, which means a new listener is added every time a terminal operator is applied to the resulting flow. A buffer with the \u003Ca href=\"https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel/-b-u-f-f-e-r-e-d.html\">default size\u003C/a> is used to buffer values received from the listener, use the \u003Ca href=\"https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/buffer.html\">\u003Ccode>buffer\u003C/code> operator\u003C/a> on the flow to specify a user-defined value and to control what happens when data is produced faster than consumed, i.e. to control the back-pressure behavior. Often you are only interested in the latest value received, in this case you can use the \u003Ca href=\"https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/conflate.html\">\u003Ccode>conflate\u003C/code> operator\u003C/a> to disable buffering.\u003C/p>\u003Cp>The listener is removed once the flow \u003Ca href=\"https://kotlinlang.org/docs/reference/coroutines/flow.html#flow-completion\">completes\u003C/a> or is \u003Ca href=\"https://kotlinlang.org/docs/reference/coroutines/flow.html#flow-cancellation\">cancelled\u003C/a>.\u003C/p>\u003Ch3>\u003Ca href=\"https://github.com/Kotlin/kotlinx.serialization\">Serialization\u003C/a>\u003C/h3>\u003Cp>The official Firebase SDKs use different platform-specific ways to support writing data with and without custom classes in \u003Ca href=\"https://firebase.google.com/docs/firestore/manage-data/add-data#custom_objects\">Cloud Firestore\u003C/a>, \u003Ca href=\"https://firebase.google.com/docs/database/android/read-and-write#basic_write\">Realtime Database\u003C/a> and \u003Ca href=\"https://firebase.google.com/docs/functions/callable\">Functions\u003C/a>.\u003C/p>\u003Cp>The Firebase Kotlin SDK uses Kotlin serialization to read and write custom classes to Firebase. To use Kotlin serialization in your project add the plugin to your gradle file:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-groovy prettyprint\">plugins {\n    kotlin(&quot;multiplatform&quot;) version &quot;1.9.20&quot; // or kotlin(&quot;jvm&quot;) or any other kotlin plugin\n    kotlin(&quot;plugin.serialization&quot;) version &quot;1.9.20&quot;\n}\n\u003C/code>\u003C/pre>\u003Cp>Then mark your custom classes \u003Ccode>@Serializable\u003C/code>:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">@Serializable\ndata class City(val name: String)\n\u003C/code>\u003C/pre>\u003Cp>Instances of these classes can now be passed \u003Ca href=\"https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#introduction-to-serializers\">along with their serializer\u003C/a> to the SDK:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">db.collection(&quot;cities&quot;).document(&quot;LA&quot;).set(City.serializer(), city) { encodeDefaults = true }\n\u003C/code>\u003C/pre>\u003Cp>The \u003Ccode>buildSettings\u003C/code> closure is optional and allows for configuring serialization behaviour. \u003C/p>\u003Cp>Setting the \u003Ccode>encodeDefaults\u003C/code> parameter is optional and defaults to \u003Ccode>true\u003C/code>, set this to false to omit writing optional properties if they are equal to theirs default values.\nUsing \u003Ca href=\"https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization/-encode-default/\">@EncodeDefault\u003C/a> on properties is a recommended way to locally override the behavior set with \u003Ccode>encodeDefaults\u003C/code>.\u003C/p>\u003Cp>You can also omit the serializer if it can be inferred using \u003Ccode>serializer&lt;KType&gt;()\u003C/code>. \nTo support \u003Ca href=\"https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#contextual-serialization\">contextual serialization\u003C/a> or \u003Ca href=\"https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#open-polymorphism\">open polymorphism\u003C/a> the \u003Ccode>serializersModule\u003C/code> can be overridden in the \u003Ccode>buildSettings\u003C/code> closure:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">@Serializable\nabstract class AbstractCity {\n    abstract val name: String\n}\n\n@Serializable\n@SerialName(&quot;capital&quot;)\ndata class Capital(override val name: String, val isSeatOfGovernment: Boolean) : AbstractCity()\n\nval module = SerializersModule {\n    polymorphic(AbstractCity::class, AbstractCity.serializer()) {\n        subclass(Capital::class, Capital.serializer())\n    }\n}\n\nval city = Capital(&quot;London&quot;, true)\ndb.collection(&quot;cities&quot;).document(&quot;UK&quot;).set(AbstractCity.serializer(), city) { \n    encodeDefaults = true\n    serializersModule = module\n\n}\nval storedCity = db.collection(&quot;cities&quot;).document(&quot;UK&quot;).get().data(AbstractCity.serializer()) {\n    serializersModule = module\n}\n\u003C/code>\u003C/pre>\u003Ch4>\u003Ca href=\"https://firebase.google.com/docs/firestore/manage-data/add-data#server_timestamp\">Server Timestamp\u003C/a>\u003C/h4>\u003Ca href=\"https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldValue?hl=en#serverTimestamp(\">Firestore\u003C/a>\u003Ca href=\"https://firebase.google.com/docs/reference/android/com/google/firebase/database/ServerValue#TIMESTAMP\">Realtime Database\u003C/a>\u003Ccode>kotlin\n@Serializable\ndata class Post(\n    // In case using Realtime Database.\n    val timestamp = ServerValue.TIMESTAMP,\n    // In case using Cloud Firestore.\n    val timestamp: Timestamp = Timestamp.ServerTimestamp,\n    // or\n    val alternativeTimestamp = FieldValue.serverTimestamp,\n    // or\n    @Serializable(with = DoubleAsTimestampSerializer::class),\n    val doubleTimestamp: Double = DoubleAsTimestampSerializer.serverTimestamp\n)\u003C/code>\u003Ccode>firebase-firestore\u003C/code>\u003Ccode>kotlin\n@Serializable\ndata class PointOfInterest(\n    val reference: DocumentReference, \n    val location: GeoPoint\n)\nval document = PointOfInterest(\n    reference = Firebase.firestore.collection(&quot;foo&quot;).document(&quot;bar&quot;),\n    location = GeoPoint(51.939, 4.506)\n)\u003C/code>\u003Ch4>Polymorphic serialization (sealed classes)\u003C/h4>\u003Cp>This sdk will handle polymorphic serialization automatically if you have a sealed class and its children marked as \u003Ccode>Serializable\u003C/code>. It will include a \u003Ccode>type\u003C/code> property that will be used to discriminate which child class is the serialized.\u003C/p>\u003Cp>You can change this \u003Ccode>type\u003C/code> property by using the \u003Ccode>@FirebaseClassDiscrminator\u003C/code> annotation in the parent sealed class:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">@Serializable\n@FirebaseClassDiscriminator(&quot;class&quot;)\nsealed class Parent {\n    @Serializable\n    @SerialName(&quot;child&quot;)\n    data class Child(\n        val property: Boolean\n    ) : Parent\n}\n\u003C/code>\u003C/pre>\u003Cp>In combination with a \u003Ccode>SerialName\u003C/code> specified for the child class, you have full control over the serialized data. In this case it will be:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-json prettyprint\">{\n  &quot;class&quot;: &quot;child&quot;,\n  &quot;property&quot;: true\n}\n\u003C/code>\u003C/pre>\u003Cp>\u003C/p>\u003Ch4>Serialization of Updates\u003C/h4>\u003Ccode>update\u003C/code>\u003Ccode>updateFields\u003C/code>\u003Cp>\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">documentRef.updateFields {\n    // Root level encode settings\n    encodeDefaults = false\n    serializersModule = module\n\n    &quot;field&quot; to &quot;value&quot;\n    // Set the value of otherField to &quot;1&quot; using a custom Serializer\n    &quot;otherField&quot;.to(IntAsStringSerializer(), 1)\n\n    // Overwrite build settings. All fields added within this block will have these build settings applied\n    withEncodeSettings {\n        encodeDefaults = true\n        serializersModule = otherModule\n        &quot;city&quot; to abstractCity\n    }\n}\n\u003C/code>\u003C/pre>\u003Cp>Similarly, the \u003Ccode>Query\u003C/code> methods \u003Ccode>startAt\u003C/code>/\u003Ccode>startAfter\u003C/code>/\u003Ccode>endAt\u003C/code>/\u003Ccode>endBefore\u003C/code> have an alternative method in \u003Ccode>startAtFieldValues\u003C/code>/\u003Ccode>startAfterFieldValues\u003C/code>/\u003Ccode>endAtFieldValues\u003C/code>/\u003Ccode>endBeforeFieldValues\u003C/code>\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">query.orderBy(&quot;field&quot;, &quot;otherField&quot;, &quot;city&quot;).startAtFieldValues { // similar syntax for startAfter/endAt/endBefore\n    // Root level encode settings\n    encodeDefaults = false\n    serializersModule = module\n\n    add(&quot;Value&quot;)\n\n    // Starts at &quot;1&quot; for the otherField value\n    add(1, IntAsStringSerializer())\n\n    // Overwrite build settings. All field values added within this block will have these build settings applied\n    withEncodeSettings {\n        encodeDefaults = true\n        serializersModule = otherModule\n        add(abstractCity)\n    }\n}\n\u003C/code>\u003C/pre>\u003Ch3>\u003Ca href=\"https://kotlinlang.org/docs/reference/functions.html#default-arguments\">Default arguments\u003C/a>\u003C/h3>\u003Cp>To reduce boilerplate, default arguments are used in the places where the Firebase Android SDK employs the builder pattern:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()\n        .setDisplayName(&quot;Jane Q. User&quot;)\n        .setPhotoUri(Uri.parse(&quot;https://example.com/jane-q-user/profile.jpg&quot;))\n        .build()\n\nuser.updateProfile(profileUpdates)\n        .addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {\n            @Override\n            public void onComplete(@NonNull Task&lt;Void&gt; task) {\n                if (task.isSuccessful()) {\n                    Log.d(TAG, &quot;User profile updated.&quot;)\n                }\n            }\n        })\n\n//...becomes...\n\nuser.updateProfile(displayName = &quot;Jane Q. User&quot;, photoURL = &quot;https://example.com/jane-q-user/profile.jpg&quot;)\n\u003C/code>\u003C/pre>\u003Ch3>\u003Ca href=\"https://kotlinlang.org/docs/functions.html#infix-notation\">Infix notation\u003C/a>\u003C/h3>\u003Cp>To improve readability and reduce boilerplate for functions such as the Cloud Firestore query operators are built with infix notation:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">citiesRef.whereEqualTo(&quot;state&quot;, &quot;CA&quot;)\ncitiesRef.whereArrayContains(&quot;regions&quot;, &quot;west_coast&quot;)\ncitiesRef.where(Filter.and(\n    Filter.equalTo(&quot;state&quot;, &quot;CA&quot;),\n    Filter.or(\n        Filter.equalTo(&quot;capital&quot;, true),\n        Filter.greaterThanOrEqualTo(&quot;population&quot;, 1000000)\n    )\n))\n\n//...becomes...\n\ncitiesRef.where { &quot;state&quot; equalTo &quot;CA&quot; }\ncitiesRef.where { &quot;regions&quot; contains &quot;west_coast&quot; }\ncitiesRef.where {\n    all(\n        &quot;state&quot; equalTo &quot;CA&quot;,\n        any(\n            &quot;capital&quot; equalTo true,\n            &quot;population&quot; greaterThanOrEqualTo 1000000\n        )\n    )\n}\n\u003C/code>\u003C/pre>\u003Ch3>\u003Ca href=\"https://kotlinlang.org/docs/reference/operator-overloading.html\">Operator overloading\u003C/a>\u003C/h3>\u003Cp>In cases where it makes sense, such as Firebase Functions HTTPS Callable, operator overloading is used:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">    val addMessage = functions.getHttpsCallable(&quot;addMessage&quot;)\n    //In the official android Firebase SDK this would be addMessage.call(...)\n    addMessage(mapOf(&quot;text&quot; to text, &quot;push&quot; to true))\n\u003C/code>\u003C/pre>","kotlin-first_design","#kotlin-first_design",{"name":32,"content":33,"id":34,"ref":35},"Multiplatform","\u003Cp>The Firebase Kotlin SDK provides a common API to access Firebase for projects targeting \u003Cem>iOS\u003C/em>, \u003Cem>Android\u003C/em>, \u003Cem>JVM\u003C/em> and \u003Cem>JS\u003C/em> meaning you can use Firebase directly in your common code. Under the hood, the SDK achieves this by binding to the respective official Firebase SDK for each supported platform.\u003C/p>\u003Cp>It uses the \u003Ca href=\"https://github.com/GitLiveApp/firebase-java-sdk\">Firebase Java SDK\u003C/a> to support the JVM target. The library requires \u003Ca href=\"https://github.com/GitLiveApp/firebase-java-sdk?tab=readme-ov-file#initializing-the-sdk\">additional initialization\u003C/a> compared to the official Firebase SDKs.\u003C/p>\u003Ch3 id=\"accessing-the-underlying-firebase-sdk\">Accessing the underlying Firebase SDK\u003C/h3>\u003Cp>In some cases you might want to access the underlying official Firebase SDK in platform specific code, for example when the common API is missing the functionality you need. For this purpose each class in the SDK has \u003Ccode>android\u003C/code>, \u003Ccode>ios\u003C/code> and \u003Ccode>js\u003C/code> extension properties that hold the equivalent object of the underlying official Firebase SDK. For \u003Cem>JVM\u003C/em>, as the \u003Ccode>firebase-java-sdk\u003C/code> is a direct port of the Firebase Android SDK, is it also accessed via the \u003Ccode>android\u003C/code> property.\u003C/p>\u003Cp>These properties are only accessible from the equivalent target&apos;s source set. For example to disable persistence in Cloud Firestore on Android you can write the following in your Android specific code (e.g. \u003Ccode>androidMain\u003C/code> or \u003Ccode>androidTest\u003C/code>):\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">  Firebase.firestore.android.firestoreSettings = FirebaseFirestoreSettings.Builder(Firebase.firestore.android.firestoreSettings)\n          .setPersistenceEnabled(false)\n          .build()\n\u003C/code>\u003C/pre>\u003Ch3 id=\"running-on-android\">Running on Android\u003C/h3>\u003Cp>On android, some modules (\u003Ccode>config\u003C/code>) require you to enable \u003Ca href=\"https://developer.android.com/studio/write/java8-support#library-desugaring\">Core library desugaring\u003C/a> if you have a \u003Cem>minSDK lower than API 26\u003C/em>.\u003C/p>\u003Ch3 id=\"running-on-ios\">Running on iOS\u003C/h3>\u003Cp>On iOS the official \u003Ca href=\"/projects/firebase/firebase-ios-sdk/\">Firebase iOS SDK\u003C/a> in not linked as a transitive dependency. Therefore, any project using this SDK needs to link the actual Firestore SDK as well. This can be done through your preferred installation method (Cocoapods/SPM).\u003C/p>\u003Cp>Similarly, tests require linking as well. Make sure to add the required frameworks to the search path of your test targets. This can be done by specifying a \u003Ccode>cocoapods\u003C/code> block in your \u003Ccode>build.gradle\u003C/code>:\u003C/p>\u003Cpre>\u003Ccode class=\"lang-kotlin prettyprint\">cocoapods {\n   pod(&quot;FirebaseCore&quot;) // Repeat for Firebase pods required by your project, e.g FirebaseFirestore for the `firebase-firestore` module.\n}\n\u003C/code>\u003C/pre>","multiplatform","#multiplatform",1777179357881]