Skip to content

[firestore] Different default order between web and mobile version. #3232

@klydra

Description

@klydra

Describe the bug
When I retrieve a document from Cloud Firestore, the default order of the snapshot keys is different.

To Reproduce
Steps to reproduce the behavior:

  1. Create a firestore document which contains maps in the root.
  2. Retrieve a document snapshot in flutter web and mobile (e.g. android)
  3. Get a list of the keys from the snapshot data (e.g. snapshot.data.keys.cast<String>().toList()).
  4. Generate a list of all maps with the order based on the key list you've retreived earlier.
  5. See that the order is different depending on behavior.

Expected behavior
I'd expect the default order to the be the same on all platforms.

Additional context
I have created a manual order system which sorts the list of keys based on specific criteria, instead of using the default order directly from Firebase. Just wanted to report this as I discovered it recently and because I would call different behavior for the same commands on different platforms a bug.

Flutter doctor

[√] Flutter (Channel beta, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale en-DE)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.0)
[√] IntelliJ IDEA Ultimate Edition (version 2019.2)
[√] VS Code (version 1.47.3)
[√] Connected device (3 available)

• No issues found!

EDIT : An example for this behavior - https://drive.google.com/file/d/1c2H3chI4uGYAI7QISd9yQvkCZmM1dOMX/view?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions