flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[cloud_firestore]: transaction.update accepts data as Map<String, dynamic> but should allow Object keys for FieldPath

Open quaaantumdev opened this issue 7 months ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues.

Which plugins are affected?

Database

Which platforms are affected?

Android

Description

the current implementation uses an incorrect type for the Transaction.update method's data. It only allows for Map<String,dynamic>, that excludes FieldPath as a key. FieldPath is somewhat essential.

Here is the exact line: https://github.com/firebase/flutterfire/blob/2a0bdc64086e99f8a98bd18b472b36bcfe05a9a4/packages/cloud_firestore/cloud_firestore/lib/src/transaction.dart#L64

Update: I noted before that only the method signature needs to change, that is not correct. I did look into it a bit further and the platform interfaces also work with a Map<String,dynamic> at this point. However, However, I did not see any reason this limitation should be in place, it's probably just a historically thing.

Reproducing the issue

Try patching data using Map<FieldPath, dynamic>, the signature won't accept it.

Firebase Core version

3.13.0

Flutter Version

3.29.2

Relevant Log Output


Flutter dependencies

No response

Additional context and comments

No response

quaaantumdev avatar Apr 17 '25 21:04 quaaantumdev