Repository navigation
[cloud_firestore] Strip Document Reference firestore equality to solve equality & map key bug #2081 - #2110
[cloud_firestore] Strip Document Reference firestore equality to solve equality & map key bug #2081#2110duttaoindril wants to merge 7 commits into
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 馃摑 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
鈩癸笍 Googlers: Go here for more info. |
|
@googlebot I signed it! |
|
CLAs look good, thanks! 鈩癸笍 Googlers: Go here for more info. |
|
https://github.com/FirebaseExtended/flutterfire/pull/2110/checks?check_run_id=481504083 No idea why this check is failing; seems to not be related to this PR. |
|
Hey @duttaoindril - thanks for taking to time to send up this PR. As part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. |
Description
Due to #2081, I've decided to create a simple proposal - a patch fix for the error. It simply removes the firestore equality check to let DocumentReference checking be done solely on the path.
The expected behavior is for DocumentReference to be a valid key in a map. However, due to #2081, simply using DocumentReference as a key in a map is not possible.
First, let me confirm that equality between keys is needed for a map in Dart.
Creating a dummy class as such below:
And running the code below:
As you can see from the output above, even with the same
hashCode, Dart checks to see if the keys are equal or not.Extending this to a test using Firestore
DocumentReferences, the actual behavior is as follows:Running the same code above with the changes proposed yields the following results, the expected results:
Checklist
///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?