1import 'package:cloud_firestore/cloud_firestore.dart';
2// for flutter users get cloud_firestore in your pubspec.yaml file and import in your file
3
4
5class DatabaseService {
6
7// creating a user id for individual users that sign into your app
8 final String uid;
9 DatabaseService({this.uid})
10
11
12 final CollectionReference Collection = FirebaseFirestore.instance.collection('Home');
13
14 // creating a database for users that is login your app
15 Future updateUserData(String name, String friends, int age) async {
16 var data = {
17 'name' : name,
18 'friends' : friends,
19 'age' : age,
20 };
21
22 return await Collection.doc(uid).set(data);
23 }
24// or
25
26 return await brewCollection.doc(uid).setData({
27 'name' : name,
28 'friends' : friends,
29 'age' : age,
30 });
31
32}