Search⌘ K

Solution: Firebase Firestore

Explore the solutions to the Firebase for Flutter challenges.

Solutions

Great job on completing all the steps in the previous challenge! Feel free to compare your code solutions with the solutions below.

pubspec.yaml
lib/main.dart
lib/presentation/new_task.dart
lib/presentation/tasks_screen.dart
name: todo_app
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.16.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: ^2.15.0
# SOLUTION-1
cloud_firestore: ^4.8.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.4
flutter:
uses-material-design: true
pubspec.yaml

Challenge 1: Add the cloud_firestore package

First, we add the cloud_firestore package to the application dependency in line 14 of the pubspec.yaml file.

Challenge 2: Initialize Firebase

First, on ...