Add Firebase Firestore Database

We will store additional information about the user when the sign in or register, eg. bio, preference etc.

Add package cloud_firestore to pubspec.yaml

cloud_firestore: ^4.15.5

login_screen.dart

```dart
  final _firestore = FirebaseFirestore.instance;
  Future<void> createNewUserData() async {
    _firestore.collection('users').doc(_auth.currentUser?.uid).set({
      'name': 'Mentee',
      'uid': _auth.currentUser?.uid,
      'bio': 'Flutter Devcamp Mentee',
      'completed': [],
      'recents': [],
      'badges': [],
      'certificates': [],
      'profilePic': ''
    });
  }
```

line 196 makes the call to createNewUserData

Let's get the courses from the database widgets => explore_course_list.dart add a field variable

use courses variable in the build method,

Last updated