Skip to content

Instantly share code, notes, and snippets.

@sbis04
Created May 18, 2021 03:10
Show Gist options
  • Save sbis04/ceeec3d69c4d28c610a46ef8dd045afe to your computer and use it in GitHub Desktop.
Save sbis04/ceeec3d69c4d28c610a46ef8dd045afe to your computer and use it in GitHub Desktop.
static Future<void> addItem({
required String title,
required String description,
}) async {
DocumentReference documentReferencer =
_mainCollection.doc(userUid).collection('items').doc();
Map<String, dynamic> data = <String, dynamic>{
"title": title,
"description": description,
};
await documentReferencer
.set(data)
.whenComplete(() => print("Notes item added to the database"))
.catchError((e) => print(e));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment