Skip to content

[firebase_data_connect]: Generate file use Object.hash limited to 20 arg #17764

@Maouxi

Description

@Maouxi

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Firebase Data connect

Which platforms are affected?

Android, macOS, iOS, Web, Windows

Description

The generated files create class with overriden hashcode using
int get hashCode => Object.hash( field1, field2 ...);

Their is an issue when the queried object use more than 20 fields because the Object.hash function can't have mor than 20 arg. This limitation can be easily fix by using the Object.hashAll method.

Reproducing the issue

Made a query with more than 20 field.

query myQuery()  {
    ...20FieldsFragment
}

Use the dataconnect generate command : npx -y firebase-tools@latest dataconnect:sdk:generate

Try launch the application.

Firebase Core version

4.1.1

Flutter Version

3.35.5

Relevant Log Output

Xcode build done.                                           11,2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
2

Xcode's output:

    Writing result bundle at path:
    	/var/folders/sy/dft6g6z54dq_7hb1f2m5rsz00000gp/T/flutter_tools.X6yrco/flutter_ios_build_temp_dirVQXsWo/temporary_xcresult_bundle

    ../packages/**/lib/gen/dataconnect/**.dart:110:34: Error: Too many positional arguments: 20 allowed, but 21 found.
**.dart:110
    Try removing the extra positional arguments.
      int get hashCode => Object.hash(...);
                                     ^
    org-dartlang-sdk:///flutter/third_party/dart/sdk/lib/core/object.dart:184:14: Context: Found this candidate, but the arguments don't match.
      static int hash(
                 ^^^

Flutter dependencies

No response

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions