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

Support for update and merge writes#298

Merged
collinjackson merged 6 commits intoflutter:masterfrom
collinjackson:firestore_merge_writes
Dec 5, 2017
Merged

Support for update and merge writes#298
collinjackson merged 6 commits intoflutter:masterfrom
collinjackson:firestore_merge_writes

Conversation

@collinjackson
Copy link
Copy Markdown
Contributor

@collinjackson collinjackson commented Dec 5, 2017

This is required for the todo list app: https://github.com/flutter/udacity-course/pull/26

/// By providing the [SetOptions] objects returned by [merge], the [setData()]
/// calls on [DocumentReference] can be configured to perform granular merges
/// instead of overwriting the target documents in their entirety.
class SetOptions {
Copy link
Copy Markdown
Contributor Author

@collinjackson collinjackson Dec 5, 2017

Choose a reason for hiding this comment

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

The Android Firestore SDKs provides more advanced SetOptions functionality, but it doesn't seem to be available yet on iOS and I only implemented the lowest common denominator. I've added a comment to this effect below.

To make the API more Firebase-y and for future compatibility I'm making this a class instead of more Flutter-y optional named arguments.

@collinjackson collinjackson force-pushed the firestore_merge_writes branch from 19d7d7c to 87dbeb9 Compare December 5, 2017 18:58
const <String, dynamic>{'merge': true},
);

const SetOptions._(this._data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i almost missed this constructor. this is why we have the style rule that says constructors go first. :-)

@Hixie
Copy link
Copy Markdown
Contributor

Hixie commented Dec 5, 2017

RSLGTM

@collinjackson collinjackson merged commit 2b89c20 into flutter:master Dec 5, 2017
@collinjackson collinjackson deleted the firestore_merge_writes branch December 5, 2017 23:20
@dark-chocolate
Copy link
Copy Markdown

dark-chocolate commented Sep 17, 2018

Which library or package do we need to import in order to access the SetOptions()?
This answer does that but it is for Android (native)

julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
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

Development

Successfully merging this pull request may close these issues.

4 participants