Skip to content

Instantly share code, notes, and snippets.

@xinthink
Created March 5, 2020 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xinthink/e8f2a9fc6671bc6e139fa34d76aa2db7 to your computer and use it in GitHub Desktop.
Save xinthink/e8f2a9fc6671bc6e139fa34d76aa2db7 to your computer and use it in GitHub Desktop.
extension NoteStore on Note {
/// Save this note to FireStore.
Future<dynamic> saveToFireStore(String uid) async {
final col = notesCollection(uid);
return id == null
? col.add(toJson())
: col.document(id).updateData(toJson());
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment