Add Query.get() and MutableData-based transactions to Realtime Database #814
Open
pmodernme wants to merge 13 commits intoGitLiveApp:masterfrom
Open
Add Query.get() and MutableData-based transactions to Realtime Database #814pmodernme wants to merge 13 commits intoGitLiveApp:masterfrom
pmodernme wants to merge 13 commits intoGitLiveApp:masterfrom
Conversation
added 13 commits
April 9, 2026 11:03
Implements get() across all platforms (Android, Apple, JS, JVM) with test coverage.
Implements runTransaction across all platforms (Android, Apple, JS, JVM) with test coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two new features to the Realtime Database module.
Query.get()Previous implementations used
Query.valueEvents.first()to fetch avalue, but that returns either local or remote data depending on
whether persistence is enabled.
get()always fetches from the serverand falls back to the locally-cached value (or null) if offline,
giving consistent behavior regardless of persistence settings.
Implemented on Android, Apple, and JS.
runTransaction(MutableData)A new
DatabaseReference.runTransactionoverload that mirrors theFirebase SDK's
MutableData-based transaction API. Unlike the existingserializer-based overload — which always commits — this variant lets
callers explicitly abort a transaction by returning
Transaction.abort()from the handler. Returns the committed
DataSnapshot, or null ifaborted.
New public types:
MutableData— a multiplatform wrapper around the platformMutableDatatype, withkey,value,child(),hasChildren,and
children. Inlinevalue<T>()/setValue<T>()extensionfunctions handle serialization.
Transaction/Transaction.Result— DSL for returningsuccessor
abortfrom the transaction handler.Bug fix
NSNullvalues in iOSDataSnapshot.valuenow correctly returnnullinstead of theNSNullsentinel object.API surface
Public API binary-compatibility files updated for Android and JVM.
Test plan
firebase-databasecommon testsQuery.get()returns remote data on Android, iOS, JSrunTransaction(MutableData)commits and aborts correctlyon all platforms
NSNull→nullfix on iOS