Firebase Dart Parity

As of origin/main 9122437c, 2026-11-29.

Storage 184Auth 218Firestore 101Realtime Database 162Remote Config 97Installations 38Analytics 44Cloud Functions 97App Check 96AI Logic 150Data Connect 99

This document compares the public API of Cloud Storage for Firebase in four official SDKs with firebase_storage_dart 0.1.0 (firebase_storage/firebase_storage_dart):

Read from docs/storage_parity.md on origin/main at 9122437c.

About this comparison: sources, status words, path shorthand
  • JS: packages/storage/src of firebase-js-sdk main. It is the reference for the protocol and for behaviour.
  • Android: firebase-storage of firebase-android-sdk.
  • iOS: FirebaseStorage of firebase-ios-sdk.
  • C++: storage of firebase-cpp-sdk (the desktop code speaks REST itself; the mobile wrappers delegate to the native SDKs).
  • Dart: the API of firebase_storage_dart 0.1.0 as it is in the code.

The sources were read as shallow clones on 2026-11-21, from GitHub only. Line numbers are from that reading and will drift. A cell of the Dart column that says "gap" means there is no equivalent; "n/a" means the feature belongs to another runtime; the notes say how a decided behaviour works. A "—" means the SDK has no such API.

Path shorthand: J: is JS src/, A: is Android src/main/java/com/google/firebase/storage/, I: is iOS Sources/, C: is C++ storage/src/ (C:d desktop, C:i iOS wrapper, C:a Android wrapper).

Where the C++ wrapper on mobile delegates to the native SDK, the behaviour of that SDK applies. C++ desktop is the only C++ code that speaks HTTP itself, and its behaviour is described where it differs.

184 features4 missing29 won't do0 different151 same

Same: Dart has it as the official SDKs do. Different: Dart has it, in another shape or with other behaviour. Missing: a gap Dart could close. Won't do: will not be done, is not needed, makes no sense in Dart or does not apply to it; none of it is a gap. The doc has no Status column for Storage; the tag is read from the Dart cell: a cell that starts with “gap” is Missing, except “gap (not needed)”, “gap (won't do)”, “gap (n/a)” and “gap (StateError)”, which are Won't do; “n/a” and “—” are Won't do; every other cell is Same.

Instance and configuration

FeatureJSAndroidiOSC++DartNotes
Get default instancegetStorage(app?) api.ts:330FirebaseStorage.getInstance() / Firebase.storageStorage.storage()Storage::GetInstance(app)FirebaseStorage(app)Dart has no instance cache by design (shim does it).
Instance for another bucketgetStorage(app, 'gs://b')getInstance(app, url)Storage.storage(app:url:)GetInstance(app, url)bucket:Android/iOS/C++ reject a URL with a path component; JS Location.makeFromBucketSpec does the same via regex.
Bucket from app optionsoptions.storageBucket (extractBucket service.ts:31)samesame (fatalError when missing, Storage.swift:341)app->options().storage_bucket()default app.options.storageBucket, else ArgumentErrorJS throws no-default-bucket / invalid-default-bucket.
Accept bucket with or without gs://yesyesyesyesyes
Read the bucket backref.bucketref.getBucket()ref.bucketStorage::url()FirebaseStorage.bucket
Read the app backstorage.appgetApp()storage.appapp()app
EmulatorconnectStorageEmulator(storage, host, port, {mockUserToken}) api.ts:356; also auto from FIREBASE_STORAGE_EMULATOR_HOST via getDefaultEmulatorHostnameAndPort api.ts:337useEmulator(host, port)useEmulator(withHost:port:)UseEmulator(host, port) (logs an error and ignores a second call once configured, C:d storage_desktop.cc:140)emulatorHost (host:port), emulatorHostFromEnvironment
Emulator mock tokenoptions.mockUserToken (string or object, sets _overrideAuthToken) service.ts:59———mockUserTokenJS only.
Emulator over https (Cloud Workstations)isCloudWorkstation(host) picks https and pings the server, service.ts:50———gapDart's emulator is http only. Rare.
Custom host or domain (non-emulator)internal host setter only, default firebasestorage.googleapis.com (J:implementation/constants.ts)constant PROD_BASE_URL (A:network/NetworkRequest.java:52), not configurablefixedfixedgap (not needed)No official SDK exposes a public custom-host option outside the emulator.
Attach tokens over plain httpJS always sends (emulator http)sendsonly https or loopback, unless debug-only allowInsecureTokenAttachment (I:Internal/StorageTokenAuthorizer.swift:47)desktop sendstokens only over https, the emulator or loopback (0.1.0)Decided for 0.1.0: the client attaches a token only to an https host, to emulatorHost, or to a loopback host.
Max operation retry time (get/update metadata, delete, list, URL)maxOperationRetryTime, 2 min, settableset/getMaxOperationRetryTimeMillis, 2 minmaxOperationRetryTime, 120 smax_operation_retry_time, 120 sStorageRetryPolicy.operationDart is immutable at construction; others are mutable at runtime.
Max upload retry timemaxUploadRetryTime, 10 minset/getMaxUploadRetryTimeMillis, 10 minmaxUploadRetryTime, 600 smax_upload_retry_time, 600 supload
Max download retry timenone (downloads use the operation time, requests.ts:219)set/getMaxDownloadRetryTimeMillis, 10 minmaxDownloadRetryTime, 600 smax_download_retry_time, 600 sdownload (10 min)Dart follows the three-value split of the native SDKs, JS only has two. Notes need to say which JS value is used for Dart download when it differs.
Max per-chunk upload retry—set/getMaxChunkUploadRetry, 60 s (A:FirebaseStorage.java:56)——gapAndroid caps retrying one chunk separately from the overall upload.
Max upload chunk sizenone, fixed 256 KiB growing to 16 MiB effective (J:task.ts:336)none, 256 KiB growing to 32 MiB (A:UploadTask.java:59-60)uploadChunkSizeBytes, default unlimited, rounded to 256 KiB multiples (I:Storage.swift:109)—FirebaseStorage(maxUploadChunkSize:), default null (0.1.1)Like iOS: null sends the rest of an upload of bytes or a file in one request on the VM (iOS also uses one request by default); a value is rounded down to a multiple of 256 KiB, at least 256 KiB. Streams and the web are always chunked, up to 16 MiB or the cap.
Callback queue / executor— (promises, microtasks)Executor and Activity overloads on every listenercallbackQueue: DispatchQueue, default main (I:Storage.swift:112)callbacks on a worker thread, no queue optionn/aDart streams and futures deliver on the event loop.
App CheckappCheckProvider.getToken() -> X-Firebase-AppCheck; error -> header dropped; FirebaseServerApp.settings.appCheckToken shortcut (service.ts:182)InteropAppCheckTokenProviderAppCheckInterop.getToken(forcingRefresh:false), header X-Firebase-AppCheck (I:StorageTokenAuthorizer.swift:69)desktop waits up to 10 s for a token (C:d storage_reference_desktop.cc:234)app.appCheckProvider?.getToken
Auth headerAuthorization: Firebase <idToken> (request.ts:237)samesamesameyes
Auth 401 handlingone retry is not done; 401 maps to unauthenticatedsamesamekErrorUnauthenticatedone forced refreshDart adds one forced token refresh; no official SDK does. See the differences below.
X-Firebase-Storage-Versionwebjs/<sdk version> (request.ts:245)Android/<gms version>ios/<version>Cpp/<version>dart/<version>
X-Firebase-GMPIDdead code path, _appId always null (request.ts:251)sent (A:NetworkRequest.java:62)sent (I:StorageTokenAuthorizer.swift:36)not sentyes (a deliberate fix, see below)
Per-request timeoutRequestInfo.timeout = retry budgetconnection timeouts + retry budgetrequest.timeoutInterval = maxUploadRetryTime for uploadsnone (timeout_ms = 0 for gets, C:d storage_reference_desktop.cc:245)requestTimeout, an idle timeout (0.1.1)Fires when no byte of the request body is sent for that long, when no response comes that long after the body was sent, or when a response body pauses that long; a long transfer never times out while data flows. On the web it bounds the time to the response.
Release resources / disposeapp.delete() -> app-deleted for later requests (service.ts:346)——~Storage()close() (later calls throw StateError)
Instance equality—equals on app+urlisEqual, hash—gap (trivial)

References and paths

FeatureJSAndroidiOSC++DartNotes
Root referenceref(storage)getReference()reference()GetReference()ref()
Reference by pathref(storage, 'a/b')getReference(path)reference(withPath:)GetReference(path)ref(path)
Reference from URLref(storage, 'gs://…' or 'https://…') (location.ts)getReferenceFromUrl(url)reference(forURL:), reference(for: URL)GetReferenceFromUrl(url)refFromUrlJS accepts gs://, firebasestorage /v0/b/<bucket>/o/<path> and storage.googleapis.com / storage.cloud.google.com. A different bucket gives bucketMismatch on iOS, an error on C++, accepted on JS and Android. Dart follows JS.
Reference from another referenceref(ref, path)childchildChildchild
child(path) normalises slashesyes (child() path.ts)yes (Slashes.normalizeSlashes, A:internal/Slashes.java)yes (StoragePath)yesyes
parentref.parent (null at root)getParent()parent()GetParent()yes
rootref.rootgetRoot()root()—yes
nameref.namegetName()namename()yes
fullPathref.fullPathgetPath()fullPathfull_path()yes
bucketref.bucketgetBucket()bucketbucket()yes
storage back-referenceref.storagegetStorage()storagestorage()yes
gs:// stringtoString()toString()description—gsUri, toString
Equality / hash—equals, hashCode, compareTo (A:StorageReference.java:675-689)isEqual, hash—yes (==, hashCode); gap: compareToTrivial, later.
Operations on the root referencethrow invalid-root-operation (reference.ts:146)request fails (404 etc.)request failsrequest failsinvalid-root-operation (0.1.0)Decided for 0.1.0: the client throws before sending a request.
Reference validity check———is_valid()n/aC++ null-object pattern.
Active task lists—getActiveUploadTasks(), getActiveDownloadTasks()——gap (won't do)Android keeps a task registry (A:StorageTaskManager.java). Shim can do it.

Metadata

Field names are given per SDK. "R" = read-only, "S" = settable at upload or update.

FieldJS (FullMetadata)Android (StorageMetadata)iOS (StorageMetadata)C++ (Metadata)DartNotes
bucketbucket RgetBucket() Rbucket Rbucket() Rbucket R
fullPathfullPath RgetPath() Rpath Rpath() RfullPath R
namename RgetName() Rname Rname() Rname R
generationgeneration R (string)getGeneration() R (string)generation R (Int64)generation() R (int64)generation RJS and Android use a string, and so does Dart (String?).
metagenerationmetageneration RgetMetadataGeneration() Rmetageneration Rmetadata_generation() Rmetageneration R
sizesize R (number)getSizeBytes() Rsize Rsize_bytes() Rsize R (int)
timeCreatedtimeCreated R (ISO string)getCreationTimeMillis() RtimeCreated R (Date)creation_time() R (seconds on desktop, C:d metadata_desktop.cc:41)timeCreated R (DateTime?)
updatedupdated R (string)getUpdatedTimeMillis() Rupdated Rupdated_time() Rupdated R
md5Hashmd5Hash R, and in UploadMetadata settable ("Base64 MD5 of the object being uploaded", public-types.ts:169)getMd5Hash() Rmd5Hash Rmd5_hash() Rmd5Hash R and S (0.1.0)SettableMetadata.md5Hash is sent with an upload, as UploadMetadata.md5Hash in JS. Production does not verify it: it stores the real hash of the data, so compare the md5Hash of the returned FullMetadata yourself.
cacheControlSsetCacheControl SSset_cache_control SS
contentDispositionSSSSS
contentEncodingSSSSS
contentLanguageSSSSS
contentTypeSSSSS
customMetadatacustomMetadata S (map)setCustomMetadata(key, value), getCustomMetadataKeys()customMetadata Scustom_metadata() map, desktop returns a pointercustomMetadata S
downloadTokensdownloadTokens R (string[], from comma list)———downloadTokens ROnly JS surfaces them.
Back-reference to referenceref R (optional)getReference()—reference()gap (won't do)Dart FullMetadata has no ref, Reference already holds it.
isFile / isFolder——isFile, isFolder (I:StorageMetadata.swift:130; .folder is never set)—gap (won't do)
Raw dictionary form——dictionaryRepresentation(), init(dictionary:)—toJson()
Copy-with—Builder(original)copy()copy ctorSettableMetadata.copyWith
getMetadatagetMetadata(ref)getMetadata()getMetadata(completion:)GetMetadata()metadata()GET /b/<bucket>/o/<path> in all of them.
updateMetadataupdateMetadata(ref, SettableMetadata)updateMetadata(metadata)updateMetadata(_:)UpdateMetadata(metadata)updateMetadataPATCH. JS semantics for "clear a field" (null) are in implementation/metadata.ts (metadataToDict); the Dart documentation of SettableMetadata states it.
Default content type at uploadmetadata.contentType, else blob type, else application/octet-stream (requests.ts:300)from stream/uri, else application/octet-streamfrom file extension (I:StorageUploadTask.swift:310), else requiredcontent_type argumentyes (JS rule)

Uploads

FeatureJSAndroidiOSC++DartNotes
Upload bytes, simpleuploadBytes(ref, Blob/Uint8Array/ArrayBuffer, metadata) (multipart/related, X-Goog-Upload-Protocol: multipart) requests.ts:330putBytes(byte[], metadata?) (always resumable)putData(_:metadata:) (always resumable)PutBytes(buffer, size, metadata?, listener?, controller?) (desktop: one POST of the raw body, C:d storage_reference_desktop.cc:445)putBytesOnly JS has a non-resumable multipart path. Android, iOS use resumable for every size.
Upload bytes, resumable, with taskuploadBytesResumableputBytes returns UploadTaskputData returns StorageUploadTaskPutBytes returns a future plus ControllerstartUpload
Resumable thresholddata > 256 KiB resumable; smaller single request (task.ts:172)alwaysalwaysnone (single POST)startUpload: up to 256 KiB one multipart request, above that a session; putBytes and putString always one multipart request (0.1.0)As JS for startUpload. putBytes and putString never open a session, whatever the size.
String uploaduploadString(ref, value, format, metadata)———putString
String formatsraw (UTF-8), base64, base64url, data_url (J:implementation/string.ts:38-62)———StringFormat.raw/base64/base64Url/dataUrlinvalid-format on bad input.
Upload from file— (browser File is a Blob)putFile(Uri, metadata?, existingUploadUri?)putFile(from: URL, metadata?)PutFile(path, metadata?, listener?, controller?)putFile(File) in io.dartiOS on device can use a background URLSession for file uploads (I:StorageUploadTask.swift:130-140); no Dart equivalent.
Upload from stream— (Node/browser streams are not accepted)putStream(InputStream, metadata?) (unknown length allowed, total byte count -1)——startStreamUpload(Stream, length:); length optional since 0.2.0 (totalBytes -1 until the stream ended)Android accepts unknown length through AdaptiveStreamBuffer. Dart without length: always a resumable session started without X-Goog-Upload-Header-Content-Length, chunks of 256 KiB doubling to 16 MiB (or maxUploadChunkSize), one stream event read ahead so the last chunk goes with upload, finalize (an empty stream sends one empty finalize). The chunk stays in memory until confirmed, for retries and resume.
Upload from BlobBlob———n/aWeb only. Dart uses Uint8List.
Upload from ArrayBuffer / Uint8Arrayyesbyte[]Datavoid* + sizeUint8List
Pausetask.pause() -> boolpause()pause()Controller::Pause()pause()
Resumetask.resume() -> boolresume()resume()Controller::Resume()resume()
Canceltask.cancel() -> bool (JS cancels from running only, in practice paused is ignored; doc says both)cancel()cancel()Controller::Cancel()cancel() (also from paused, a deliberate fix)
Progresson('state_changed', next) with UploadTaskSnapshot {bytesTransferred, totalBytes, state, metadata, ref, task}addOnProgressListener (bytesTransferred, totalByteCount)observe(.progress) with snapshot.progressListener::OnProgress(controller)progress stream
Paused notificationstate paused in state_changedaddOnPausedListenerobserve(.pause)Listener::OnPausedUploadState.paused on the stream
Success / failure listenersthen, catch, observer complete/erroraddOnSuccess/Failure/Complete/Canceled Listener, getResult, getExceptionobserve(.success), observe(.failure)futuresresult future
Canceled as a distinct signalstate canceled, rejection with canceledaddOnCanceledListener, isCanceledStorageErrorCode.cancelledkErrorCancelledcanceled exception
Task state querysnapshot.stateisInProgress, isPaused, isComplete, isSuccessful, isCanceledsnapshot.status (resume/progress/pause/success/failure)Controller::is_paused(), bytes_transferred(), total_byte_count()state, bytesTransferred, totalBytes
Remove listenersunsubscribe function from onremoveOn*ListenerremoveObserver(withHandle:), removeAllObserverslistener lifetimen/aDart stream subscription cancel.
Activity-scoped listeners—addOn*Listener(Activity, …) auto-removed on stop (A:internal/ActivityLifecycleListener.java)——n/aAndroid lifecycle.
Async/await formpromise is thenableTask<T> (Play services) and Kotlin taskState Flow (A:Storage.kt:143)putDataAsync(_:metadata:onProgress:) etc. (I:AsyncAwait.swift)Future<T>result future plus stream
Task as FutureUploadTask.thenTask<T>—Future<T>result (client); shim yesThe client's tasks are not Futures (await result). FlutterFire's Task implements Future<TaskSnapshot> over TaskPlatform.onComplete, so await ref.putData(...) and await ref.writeToFile(...) complete with a snapshot through the shim (firebase_storage_dart_platform/test/task_test.dart, group "tasks are futures").
Upload session startPOST X-Goog-Upload-Command: start + X-Goog-Upload-Header-Content-Length/Type (requests.ts:428)ResumableUploadStartRequestGTMSessionUploadFetcher (uploadType=resumable, I:StorageUploadTask.swift:112)—yes
Upload session query (after failure, pause, resume)X-Goog-Upload-Command: query, reads X-Goog-Upload-Size-Received (requests.ts:465)ResumableUploadQueryRequestGTM—yes
Resume the same session after an app restart—putFile(uri, metadata, existingUploadUri) plus TaskSnapshot.getUploadSessionUri() (A:StorageReference.java:280, UploadTask.java:622)— (GTM keeps a session in-process; background session for files)—UploadTask.sessionUri, existingSessionUri on startUpload, startStreamUpload, putFile (0.1.0)Decided for 0.1.0, after Android. The uploaded bytes are asked from the server (query) before sending.
Session cancel on cancel()X-Goog-Upload-Command: cancelResumableUploadCancelRequestGTM stop—yes (JS)
Chunk size, first256 KiB (RESUMABLE_UPLOAD_CHUNK_SIZE)256 KiB (PREFERRED_CHUNK_SIZE)whole object by default (.max), caller can cap—256 KiB
Chunk growthdoubles after each success while size*2 < 32 MiB, so the cap is 16 MiB (task.ts:336)doubles while < 32 MiB, resets to 256 KiB after a failed send (A:UploadTask.java:486-497)none—doubling, cap 16 MiB (or maxUploadChunkSize), when chunkedAndroid resets the chunk size after a failure, JS does not. Dart chunks streams, the web and instances with maxUploadChunkSize; on the VM bytes and files go in one request.
Upload commandsupload, upload, finalize, finalize with X-Goog-Upload-Offset (requests.ts:538)sameGTM—yes
Checksum on uploadmd5Hash in UploadMetadata; no client-side verificationnone; HTTP 409 maps to ERROR_INVALID_CHECKSUM (A:StorageException.java:89)none (nonMatchingChecksum exists, but nothing raises it, I:StorageError.swift:121)kErrorNonMatchingChecksum (mapped from iOS/Android)gap: the client does not verify; production does not eitherNo official SDK verifies the MD5 or CRC32C on the client. JS has a TODO for per-range x-range-md5 (requests.ts:560).
Server size mismatch guardserver-file-wrong-size when status total differs from the data (requests.ts:529)"Unexpected error. The server lost a chunk update." (A:UploadTask.java:406)——server-file-wrong-size
Retry of a failing chunkwhole-request backoff (see section 10)per-chunk loop with sleepTime that resets on success (A:UploadTask.java:341-456)GTM retrydesktop retries whole POSTJS backoff, with the wait reset

Downloads

FeatureJSAndroidiOSC++DartNotes
Bytes into memorygetBytes(ref, maxDownloadSizeBytes?) -> ArrayBuffergetBytes(long maxDownloadSizeBytes) (required)getData(maxSize:completion:), data(maxSize:) asyncGetBytes(buffer, buffer_size, listener?, controller?)getBytes({maxSize})Different semantics below.
Behaviour at the size limitSends Range: bytes=0-N, accepts 200 or 206, then truncates to N silently (J:reference.ts:157-170, requests.ts:228). No error.Throws IndexOutOfBounds ("the maximum allowed buffer size was exceeded"), mapped to unknown (A:StorageReference.java:411)Cancels the task with downloadSizeExceeded(total:maxSize:) (I:StorageReference.swift:196, 563)Android/iOS wrappers return kErrorDownloadSizeExceeded; desktop copies what fits the buffergetBytes throws download-size-exceeded (0.1.0)Decided for 0.1.0: the request asks for maxSize + 1 bytes, so one extra byte proves the overflow. JS truncates silently.
BlobgetBlob (browser only; Node throws)———n/a
StreamgetStream (Node only: ReadableStream; browser throws)getStream(), getStream(StreamProcessor) -> StreamDownloadTask——openRead([start, end])
Range / offsetRange only via maxDownloadSizeBytes (start fixed at 0)GetNetworkRequest sets Range: bytes=<start>- to resume (A:network/GetNetworkRequest.java:32)via GTM resume data—openRead(start, end)Only the Dart plan exposes arbitrary ranges.
To a file—getFile(File), getFile(Uri) -> FileDownloadTaskwrite(toFile:) -> StorageDownloadTask, writeAsyncGetFile(path, listener?, controller?)startDownloadToFile(File) -> DownloadTask and writeToFile(File) -> Future<int> in io.dart (partial sibling, rename on success)
Download task object—FileDownloadTask, StreamDownloadTask (both StorageTask)StorageDownloadTask (observable)Controller out-parameterDownloadTask for files, VM only (io.dart, 0.2.0); the shim's writeToFile wraps itNo task for streams: openRead is a Stream, paused and canceled through its subscription.
Pause / resume / cancel download—pause(), resume(), cancel() on both taskspause(), resume(), cancel() (resume data in memory, I:StorageDownloadTask.swift:67)Controller (desktop uses curl pause)DownloadTask.pause(), resume(), cancel() (0.2.0); cancel from paused tooA pause closes the connection (a held-open response times out on the server); resume() sends Range: bytes=<written>- from the partial file.
Resume after failure—file download resumes from the written offset and fails when the ETag changes (A:FileDownloadTask.java:213-225); stream task throws "The ETag on the server changed" (A:StreamDownloadTask.java:133)GTM resume data—DownloadTask (and writeToFile) resume from the written offset after a broken body, with the backoff and download time of StorageRetryPolicy, reset by bytes received (0.2.0)Generation guard instead of the ETag: each response's x-goog-generation is compared with the metadata's generation; without the header the metadata is read again before a resumed request and before the rename. A change fails with object-changed. The ETag is not used: it changes with the metageneration (a metadata-only update), which would fail downloads whose bytes did not change.
Download progress—addOnProgressListener on bothobserve(.progress), progress: ProgressListener::OnProgressDownloadTask.progress (0.2.0)At most one event per 64 KiB and 100 ms, plus the size once the metadata is read and every change of state; no replay, as uploads (gap 7). openRead has no progress.
Download chunk size—256 KiB (PREFERRED_CHUNK_SIZE, both tasks)——n/a
Download URLgetDownloadURL(ref) -> https://<host>/v0/b/<bucket>/o/<path>?alt=media&token=<first token> (metadata.ts:166-190)getDownloadUrl() -> UridownloadURL(completion:)GetDownloadUrl()downloadUrl()JS throws no-download-url when the object has no token (reference.ts:474). iOS builds the same URL (StorageGetDownloadURLTask.swift:69).
Download URL with a token that is missingno-download-urlStorageException (object has no token)StorageError.unknown/404errorno-download-url (0.1.0)Dart raises it, as JS does.
Download over emulatorURL uses http://host:portsamesamesameas JS

List, listAll, pagination

FeatureJSAndroidiOSC++DartNotes
One pagelist(ref, {maxResults, pageToken})list(int maxResults), list(int, String pageToken)list(maxResults:), list(maxResults:pageToken:)List(max_results_per_page = 1000, page_token)list({maxResults, pageToken})Request has delimiter=/, prefix=<path>/, maxResults, pageToken.
All pageslistAll(ref) (recursive helper, default page size 1000)listAll()listAll(completion:)— (loop List yourself)listAll()
Lazy paging as a stream————listPages({pageSize})Dart extra.
maxResults bounds1..1000, invalid-argument1..1000, IllegalArgumentException (A:StorageReference.java:562-587)none client-sidenone client-side (default 1000)1..1000
Result fieldsitems, prefixes, nextPageTokengetItems(), getPrefixes(), getPageToken()items, prefixes, pageTokenitems(), prefixes(), next_page_token()ListResult(items, prefixes, nextPageToken)Android and iOS call it pageToken.
Prefix and items as referencesStorageReferenceStorageReferenceStorageReferenceStorageReferenceReference
Listing needs Rules v2yesyesyes (doc, I:Result.swift:83)yesdocNote in Dart docs.
Kotlin destructuring—component1..3——n/a

Delete

FeatureJSAndroidiOSC++DartNotes
Delete objectdeleteObject(ref)delete()delete(completion:)Delete()delete()DELETE /b/<bucket>/o/<path>.
Delete a folder or prefix—————No SDK supports recursive delete.
Delete a missing objectobject-not-foundERROR_OBJECT_NOT_FOUNDobjectNotFoundkErrorObjectNotFoundobject-not-found

Errors

Mapping from HTTP status (all SDKs read the status; error body use differs). "Raised?" says whether the code is produced anywhere in that SDK's source.

Code (JS name)JSAndroidiOSC++DartNotes
unknownyes (any other status)ERROR_UNKNOWN -13000unknown -13000kErrorUnknownunknown
object-not-found404ERROR_OBJECT_NOT_FOUND -13010 (404)objectNotFound -13010 (404)kErrorObjectNotFoundobject-not-found
bucket-not-founddefined, never raisedERROR_BUCKET_NOT_FOUND -13011, never raisedbucketNotFound -13011, never raisedkErrorBucketNotFound, never raised on desktopnot raisedServer 404 is ambiguous, all SDKs report object-not-found.
project-not-founddefined, never raisedERROR_PROJECT_NOT_FOUND -13012, never raisedprojectNotFound -13012, never raisedkErrorProjectNotFoundnot raised
quota-exceeded402ERROR_QUOTA_EXCEEDED -13013 (no 402 mapping in calculateErrorCode)quotaExceeded (402)kErrorQuotaExceeded (402)quota-exceeded
unauthenticated401ERROR_NOT_AUTHENTICATED -13020unauthenticated -13020kErrorUnauthenticatedunauthenticated
unauthorized403ERROR_NOT_AUTHORIZED -13021unauthorized -13021kErrorUnauthorizedunauthorized
unauthorized-app401 with body text "Firebase App Check token is invalid" (requests.ts:112)———unauthorized-app (from the body of the error response)JS only.
retry-limit-exceededbackoff budget spent (request.ts:182, task.ts:130)ERROR_RETRY_LIMIT_EXCEEDED -13030 (NETWORK_UNAVAILABLE); getIsRecoverableException()retryLimitExceeded -13030kErrorRetryLimitExceeded (also 408 on desktop, C:d curl_requests.cc:84)retry-limit-exceeded
invalid-checksumdefined, never raisedERROR_INVALID_CHECKSUM -13031 (HTTP 409)nonMatchingChecksum -13031, never raisedkErrorNonMatchingChecksumnot raisedMapped by status 409 only on Android.
download-size-exceeded—— (wrapped as unknown)downloadSizeExceeded -13032kErrorDownloadSizeExceededdownload-size-exceeded
object-changed—"The ETag on the server changed" (text of a StorageException, A:StreamDownloadTask.java:133)——object-changed (0.2.0)Dart only: a DownloadTask saw a new generation of the object (gap 9). The shim keeps the code.
canceledyesERROR_CANCELED -13040cancelled -13040kErrorCancelledcanceledSpelling differs between SDKs, Dart follows JS.
invalid-event-namedefined, never raised———gap (won't do)
invalid-urlbad gs:///https URLIllegalArgumentExceptionbucketMismatch / invalidArgumentlog + invalid referenceinvalid-url
invalid-default-bucketbad storageBucket in options—fatalError—ArgumentError
no-default-bucketno storageBucket—fatalError (I:Storage.swift:341)—ArgumentError
cannot-slice-blobblob slice returned null———gap (n/a)Blob only.
server-file-wrong-sizeyestext only——server-file-wrong-size
no-download-urlyes———no-download-url (0.1.0)Add.
invalid-argumentvalidators (e.g. maxResults)IllegalArgumentExceptioninvalidArgument -13050—invalid-argument
invalid-argument-countdefined, never raised———gap (n/a)
app-deletedrequests after app.delete()———gap (StateError)Dart throws StateError after close().
invalid-root-operationroot reference———invalid-root-operation (0.1.0)Add.
invalid-formatbad string for uploadString———invalid-format
internal-errorimpossible-state checks—internalError -13052—internal-error (0.2.0)Raised when an upload session reports more bytes than the client sent, or a data source returns another size than asked. Malformed responses stay unknown, as JS handlerCheck.
unsupported-environmentmissing polyfill, getBlob in Node———gap (n/a)
bucket-mismatch——bucketMismatch -13051GetReferenceFromUrl check (C:common storage.cc:199)follow JS
path-error——pathError -13053—gap (n/a)
HTTP status on the errorStorageError.status (set, but 0 for object-not-found, error.ts:42)getHttpResultCode()ResponseErrorCode in userInfo—httpStatus (always set)
Server body on the errorcustomData.serverResponse (raw string)—ResponseBody in userInfo—serverResponse (16 KiB cap)
Underlying cause—getCause()NSUnderlyingErrorKey—cause (with its stackTrace)Never part of the message or toString: the text of a provider's error may hold a credential.
Numeric codes— (string)-13000 series-13000 seriesError enum (no values stable across wrappers)n/aThe shim maps to FlutterFire strings.

Observers, listeners, threading and callback queues

FeatureJSAndroidiOSC++DartNotes
Observer APIon('state_changed', next?, error?, complete?) or StorageObserver object; returns Unsubscribeper-state addOn…Listenerobserve(status, handler) -> handle stringListener subclass (OnPaused, OnProgress)progress broadcast stream
Statesrunning, paused, success, canceled, errorisInProgress/isPaused/isComplete/isSuccessful/isCanceledStorageTaskStatus {unknown, resume, progress, pause, success, failure}paused flagUploadState {running, paused, success, canceled, error}iOS has a distinct resume event.
Replay the last state to a late subscriberon delivers the current state first (observer.ts)listeners get a callback if already completeobserve after success fires immediately—progress starts with the current snapshot and does not replay earlier events (0.1.0)Decided for 0.1.0: a late subscriber gets the snapshot of the moment it listens, then the new events. state, bytesTransferred and result give the rest.
Thread / queue of callbacksevent loopmain thread by default, Executor overloadscallbackQueue (default main)arbitrary threadevent loop
Task scheduling—StorageTaskScheduler thread pools (A:StorageTaskScheduler.java); the upload pool has 2 threadsdispatchQueueone thread per retried request (std::thread, C:d storage_reference_desktop.cc:341)FirebaseStorage(maxConcurrentUploads:), default 8 (0.1.1)A first-in, first-out queue per instance; putBytes and putString count. A waiting task is running with 0 bytes, can be paused or canceled, and a paused task gives its turn away.
Continuationsthen/catchcontinueWith, continueWithTask, onSuccessTask—OnCompletion on Futuren/a
Progress is throttledper chunk (XHR upload progress inside a chunk too, request.ts:100)per chunkper GTM callbackper curl callbackon each chunk and state changeJS also reports sub-chunk progress through the connection's upload progress listener. Dart does the same on the VM (per byte, at most every 100 ms) and reports per chunk on the web, where the browser gives no upload progress.

Retry and backoff behaviour

ItemJSAndroidiOSC++DartNotes
Retryable statuses5xx, 408, 429, plus request-specific extra codes (J:implementation/utils.ts); network failure that never reached the server is retried too (request.ts:128)5xx, 408, 429, network unavailable (A:internal/ExponentialBackoffSender.java:60)GTMSessionFetcher defaults (5xx, 408, 429) plus "not connected to Internet" (I:Internal/StorageFetcherService.swift:90)5xx, 408, 429 (C:d storage_reference_desktop.cc:412)"per JS"
First wait1 s base, (waitSeconds + random) * 1000 where waitSeconds doubles before the first retry, so the first wait is 2 to 3 s (J:implementation/backoff.ts:35-70)1000 ms + 0..249 msGTM: 1 s, doubling1000 msyes
Growthdoubles while < 64, so cap is 64 sdoubles until MAXIMUM_WAIT_TIME_MILLI = 30 sdoubles, maxRetryInterval derived from the retry time (I:Storage.swift:324)doubles, cap 30 sJS
JitterMath.random() seconds (0 to 1 s)random.nextInt(250) msGTMnoneinjected random
Wait reset on successeach request starts its own backoff at 1 s; within one request the wait never resets (waitSeconds only grows)chunk sleepTime resets to 0 after a successful send (A:UploadTask.java:453)GTMper requestreset after a successful request (a deliberate fix)JS's sleepTime in the upload task's retry loop never resets; Dart's does.
Overall deadlinetimeout per request, from maxOperation/maxUploadRetryTimeclock.elapsedRealtime() + retryTimederived retry intervalend_time loopStorageRetryPolicy
Cancel during backoffstop() ends the wait, one more request is made with canceledcancel() flag, checked after sleepingtask cancelController::Cancelinjected delay is cancellable
Offline handlingtreated as a retryable failurepolls every second while NETWORK_UNAVAILABLE, does not double (A:ExponentialBackoffSender.java:93)explicit retry when not connected—as JS
Test hooks—static sleeper, clocktestBlockg_retry_all_errors_for_testinginjected clock, random, delay

Platform specifics

FeatureJSAndroidiOSC++DartNotes
Node streamsgetStream -> ReadableStream (api.node.ts:58)———openRead
Browser BlobgetBlob, Blob upload input———n/a
File upload from OS URI—putFile(Uri) (content://, file://)putFile(from: URL)PutFile(path)putFile(File) in io.dart
File download to OS URI—getFile(Uri), getFile(File)write(toFile: URL)GetFile(path)writeToFile(File)
Background transfers——background URLSession for file uploads on device—gap (won't do)Platform runtime.
Lifecycle-aware listeners—Activity overloads——n/a
Controller / listener split———Controller (Pause/Resume/Cancel/is_paused/bytes_transferred/total_byte_count/GetReference) and Listener (OnPaused, OnProgress) are passed to the calln/aDart UploadTask plays both roles.
Future "last result" accessors———<Op>LastResult() per methodn/aC++ Future API.
Kotlin extensions—Firebase.storage, storageMetadata {}, destructuring, taskState Flow——n/a
Swift concurrency——async overloads plus Result completion overloads (I:AsyncAwait.swift, I:Result.swift)—n/a
FirebaseServerAppappCheckToken setting honoured (service.ts:182)———n/aServer runtime object.
Large-file memoryBlob slice per chunkAdaptiveStreamBuffer reads chunk by chunkGTM reads filedesktop reads the whole file into memory for PutFile (TODO in C:d storage_reference_desktop.cc:493)stream from disk
Wire protocolREST https://firebasestorage.googleapis.com/v0/b/<bucket>/o…samesame (www.googleapis.com rewrite for uploads, I:StorageUploadTask.swift:103)sameyes
CORS (web)the browser enforces it; the bucket needs a CORS configuration———the production bucket answers access-control-allow-origin: *, exposes the x-goog-upload-* headers on the session responses, and its preflight to the upload URL allows x-goog-upload-command and x-goog-upload-offset (verified, see the README of the package)
HTTP clientXHR / fetch (Node)HttpURLConnectionGTMSessionFetchercurlpackage:http

The reasons behind the design are in storage_decisions.md.

Gaps and their state

The state is 0.1.0 (adopted): decided and part of the first release; 0.1.1 (adopted): added in 0.1.1; 0.2.0 (adopted): added in 0.2.0; later: wanted, not yet in a release; or won't do.

#StateGapWhat 0.1.0 does, or why not
10.1.0 (adopted)md5Hash in upload metadata (JS UploadMetadata.md5Hash)SettableMetadata.md5Hash. Adding a field to the immutable metadata class later would be a breaking change. Production does not verify the hash on upload; compare the returned md5Hash.
20.1.0 (adopted)Size-limit semantics of getBytes (JS truncates silently; Android, iOS and C++ fail)getBytes throws download-size-exceeded when the object is larger than maxSize. It asks for maxSize + 1 bytes with a Range header, so one extra byte proves the overflow.
30.1.0 (adopted)Resuming an upload session after the process was killed (Android existingUploadUri)UploadTask.sessionUri, and existingSessionUri on startUpload, startStreamUpload and putFile.
40.1.0 (adopted)Error codes invalid-root-operation and no-download-url, which JS raisesBoth exist, with the JS meaning.
50.1.0 (adopted)One request or a session for small uploadsstartUpload sends a single multipart request up to 256 KiB and uses a resumable session above, as JS. putBytes and putString are always one multipart request.
60.1.0 (adopted)Tokens over plain http (iOS refuses unless https or loopback)The client attaches a token only over https, to emulatorHost, or to a loopback host.
70.1.0 (adopted)Replay of the last state to a late subscriber (JS on does)The progress stream starts with the current snapshot and does not replay earlier events. state and bytesTransferred are readable at any time, and result completes for a task that already finished.
80.2.0 (adopted)Pause, resume and progress for downloads (Android and iOS tasks, C++ controllers)startDownloadToFile in io.dart returns a DownloadTask (progress, pause, resume, cancel, result); a pause closes the connection and resume sends Range: bytes=<written>- from the partial file; a broken body is resumed the same way. writeToFile runs on it, and the shim's writeToFile wraps it. VM only: the web has no file.
90.2.0 (adopted)An ETag or generation guard on resumed downloads (Android fails when the ETag changed)The generation: each response's x-goog-generation against the metadata's generation, or a metadata read before each resumed request and before the rename when the server does not send the header. A change fails with object-changed. Not the ETag, which changes with metadata-only updates.
100.2.0 (adopted)Stream upload of unknown length (Android putStream)length of startStreamUpload is optional. Without it: a resumable session even for small data, the start omits the total, each chunk is kept until the server confirms it, and one stream event is read ahead to know which chunk is the last. totalBytes is -1 until the stream ended, as Android's getTotalByteCount(). existingSessionUri works as with a length: pass the whole stream again, the bytes the server has are skipped; a session found final takes the server's size.
110.2.0 (adopted)internal-error for impossible statesinternal-error, message Internal error: … as JS. Used where the client's own invariants break (a session reporting bytes never sent, a source returning another size than asked). Malformed responses keep unknown and size mismatches keep server-file-wrong-size, as JS.
120.1.1 (adopted)Chunk size cap (iOS) and per-chunk retry limit (Android)FirebaseStorage(maxUploadChunkSize:): null (one request on the VM, like the iOS default) or a cap rounded down to 256 KiB multiples. It is transport configuration of the instance, as uploadChunkSizeBytes is on the iOS Storage, so it sits next to maxConcurrentUploads and not in StorageRetryPolicy, which is about retry time. The per-chunk retry limit stays a gap: the upload retry time covers it.
13laterEmulator over https (JS, Cloud Workstations)emulatorHost with an explicit scheme. Rare.
14won't doActive task registry, compareTo, FullMetadata.ref, isFile and isFolder, Kotlin and Swift sugar, Activity listeners, callback queues, Blob, Node streams, FirebaseServerApp, background URL sessionsTied to another runtime, or covered by Dart streams and futures. The shim can add a task registry.
15won't doapp-deleted, invalid-event-name, invalid-argument-count, cannot-slice-blob, unsupported-environment, path-errorNot reachable in Dart, or replaced by StateError or ArgumentError.

Deliberate differences from the JS SDK

Each of these is a fix, an addition or a choice. Each one has a test, named in the last column (paths are relative to firebase_storage/firebase_storage_dart).

#JS behaviourDart behaviourPinned by
1X-Firebase-GMPID is never sent (_appId is always null, request.ts:251)Sends X-Firebase-GMPID: <app.options.appId>, as Android and iOS dotest/requester_test.dart: headers > version and app id on every request, no token without a provider
2StorageError.status is 0 for object-not-found (error.ts:42)httpStatus holds the real HTTP status for every errortest/conformance/errors_conformance_test.dart: status mapping > 404 is object-not-found, with the status and the body (one test per status)
3The body of an error response is not read for the statusserverResponse holds the body, capped at 16 KiB, never headers or tokens; a body that says the App Check token is invalid maps to unauthorized-apptest/conformance/errors_conformance_test.dart: the body in serverResponse is cut at 16 KiB; 401 with the App Check message in the body is unauthorized-app
4cancel() acts from running only, although its doc says paused toocancel() works from paused as well as running, as on Androidtest/conformance/task_conformance_test.dart: cancel works from paused; test/upload_task_test.dart: cancel from paused
5Chunks double while the size stays under 32 MiB; the effective cap is 16 MiBChunks start at 256 KiB, double after each successful chunk, stop at 16 MiB, and are a multiple of 256 KiB except the lasttest/upload_task_test.dart: chunks double from 256 KiB and stop at 16 MiB
6The backoff wait of the upload retry loop (sleepTime) never resetsThe wait starts again from the beginning after a successful requesttest/conformance/task_conformance_test.dart: the retry wait resets after a successful chunk; test/upload_task_test.dart: the wait doubles while chunks keep failing and starts over after a success
7A 401 is final and maps to unauthenticatedOne forced token refresh and one more request on a 401; a second 401 maps to unauthenticated. No official SDK does this. In production an invalid ID token gets 403 (unauthorized), not 401, so the refresh is not reached by invalid tokens; it applies when the backend answers 401test/requester_test.dart: 401 > is retried once with a refreshed token, a second 401 is unauthenticated; test/conformance/errors_conformance_test.dart: a 401 is sent again once with a refreshed token
8Tokens are sent over any schemeTokens are sent only over https, to emulatorHost, or to a loopback hosttest/hardening_test.dart: tokens travel only over https, to the emulator or to loopback; test/security/hosts_test.dart: token scope of the request layer
9getBytes truncates silently at maxDownloadSizeBytesgetBytes throws download-size-exceededtest/reference_operations_test.dart: an object larger than maxSize is download-size-exceeded; test/security/limits_test.dart: asks for maxSize + 1 bytes with a Range header
10Downloads use the operation retry time (2 minutes)StorageRetryPolicy.download has its own value, 10 minutes, as Android, iOS and C++test/requester_test.dart: downloads and uploads use their own retry time
11Every resumable upload goes in chunks of 256 KiB doubling to 16 MiBOn the VM, an upload of bytes or of a file sends the rest of the object in one streamed request (upload, finalize); after a failure or a pause it queries the offset and streams from there. Streams, the web and instances with maxUploadChunkSize are chunked as JStest/upload_single_request_test.dart: one request > bytes go in one request of the session, a failure in the middle resumes from the server offset (bytes, and a file)
12No limit on uploads at oncemaxConcurrentUploads (8 by default) queues the uploads of an instance, putBytes and putString includedtest/upload_single_request_test.dart: maxConcurrentUploads > runs uploads in order, at most the limit at once

Differences between JS and the native SDKs worth knowing

  • JS never reads the error body for the status; Android and iOS keep the body in userInfo or log it.
  • JS cancel() only acts from running in the code path; Android cancels paused tasks. Dart follows Android.
  • JS 401 never retries; the forced token refresh is Dart-only.
  • JS download retry uses the 2 minute operation time; Android, iOS and C++ use a separate 10 minute download time. Dart uses the native split.