> For the complete documentation index, see [llms.txt](https://sumiths-organization.gitbook.io/flutterdevcamp-mentee-app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sumiths-organization.gitbook.io/flutterdevcamp-mentee-app/add-firebase-firestore-database.md).

# 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

```yaml
cloud_firestore: ^4.15.5
```

login\_screen.dart

````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**&#x20;

Let's get the courses from the database widgets => explore\_course\_list.dart add a field variable

```dart
final _firestore = FirebaseFirestore.instance;
```

```dart
void getCourses() {
    _firestore.collection("courses").get().then((snapshot) {
      snapshot.docs.forEach((doc) {
        setState(() {
          courses.add(Course(
              courseTitle: doc["courseTitle"],
              courseSubtitle: doc["courseSubtitle"],
              illustration: doc["illustration"],
              logo: doc["logo"],
              background: LinearGradient(colors: [
                Color(int.parse(doc["color"][0])),
                Color(int.parse(doc["color"][1])),
              ]),
              videoUrl: doc["videoUrl"]));
        });
      });
    });
  }
```

use courses variable in the build method,&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sumiths-organization.gitbook.io/flutterdevcamp-mentee-app/add-firebase-firestore-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
