Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Adding null-safe handling for Transaction.get in cloud_firestore #558

Conversation

killermonk
Copy link
Contributor

If you .get a document that doesn't exist, the result's data is null. This is expected behavior.
Transactions were attempting to .cast this to a Map without null-safety.
This caused an error in transactions when getting a document that doesn't exist.
A unit test was added to verify the fix.

If you `.get` a document that doesn't exist, the result's `data` is `null`. This is expected behavior.
Transactions were attempting to `.cast` this to a Map without null-safety.
This caused an error in transactions when getting a document that doesn't exist.
A unit test was added to verify the fix.
'path': 'foo/bar',
'data': <String, dynamic>{'key1': 'val1'}
};
if (methodCall.arguments['path'] == 'foo/bar') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now identical to DocumentReference#get on line 95

killermonk added a commit to flutter-institute/todomvc that referenced this pull request May 9, 2018
updating to latest cloud_firestore
updating to latest channel_mock

NOTE: There is a test still failing because of a firestore bug, see flutter/plugins#558
@kroikie
Copy link
Contributor

kroikie commented May 9, 2018

Thanks for this PR! This looks good to me.

@kroikie
Copy link
Contributor

kroikie commented May 9, 2018

Should be able to merge once #559 is in. @collinjackson Could you also have a look at this?

Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mravn-google mravn-google merged commit 576522c into flutter:master May 14, 2018
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants