Skip to content

Commit

Permalink
Added uploadOxygen Function
Browse files Browse the repository at this point in the history
  • Loading branch information
niloysikdar committed May 1, 2021
1 parent 1a9fbf2 commit 6059c97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
File renamed without changes.
14 changes: 14 additions & 0 deletions lib/services/database.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:plaso_connect/models/donormodel.dart';
import 'package:plaso_connect/models/oxygenpostmodel.dart';

class DatabaseMethod {
final FirebaseFirestore db = FirebaseFirestore.instance;
Expand All @@ -20,4 +21,17 @@ class DatabaseMethod {
.where("pin", isEqualTo: pin)
.snapshots();
}

Future uploadOxygen(OxygenPostModel oxygenPostModel) async {
var userMap = oxygenPostModel.toMap();
try {
await db
.collection("oxygenPosts")
.doc(oxygenPostModel.title)
.set(userMap);
print("Done");
} catch (e) {
print(e.toString());
}
}
}

0 comments on commit 6059c97

Please sign in to comment.