SlideShare a Scribd company logo
Shashank Kakroo
GDG Abu Dhabi, UAE
Introduction to Firebase
: Firestore with Flutter
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
No registration needed
Qwiklabs Code: bit.ly/menadd-apr
Feedback: bit.ly/menadd-feedback
Weekly challenge: bit.ly/menadd-challenge
MENA Digital Days - Together we learn!
Join us YouTube.com/c/GDGMENA
Website: bit.ly/menadd-website
Each week Sunday-Thursday 7-11pm (Dubai Time)
Content: 20+ LIVE workshops, Talks, & hackathons
Speakers: Googlers, Experts & 200+ communities.
Stay Home! Stay Safe! Keep learning!
Two more things ✌
Help us improve this initiative
1. ATTENDANCE CERTIFICATE weekly after filling feedback
bit.ly/menadd-feedback
2. JOIN MENA DIGITAL DAYS CHALLENGE …
bit.ly/menadd-challenge (Code: bit.ly/menadd-apr)
All winners who solve 6 quests this week Wins SPECIAL GIFT BOX! 🎁
All winners who solve 12 quests this week Wins Google Home Mini 🤩
Agenda for Today
● Introduction to Firebase
● Brief about Firebase products
● Cloud Firestore Database
● Introduction to Flutter
● Setup firebase and flutter project
● CRUD Operations with Firebase & Flutter
● Sample App with Code references
Introduction to
Firebase is google’s app development platform
● Abstracts any typical backend platform.
● Complete package for all app development needs.
● Works well with Node, Python, Java etc. on many platforms like android,
ios and web.
● Well documented and easy to adopt.
● Free for small experiments and scales according to user growth.
● Has many products which can be used independently or in combination
according to your development needs.
https://console.firebase.google.com
https://console.firebase.google.com
Firestore MENA digital days : GDG Abu dhabi
Cloud Firestore is a NoSQL document database that lets you easily store, sync, and
query data for your mobile and web apps - at global scale.
● Its a document database, stores data in form of big tree like structures but all in form of documents and
collections.
Vestibulum congue
tempus
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor.
Cloud Firestore is a NoSQL document database that lets you easily store, sync, and
query data for your mobile and web apps - at global scale.
Vestibulum congue
tempus
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor.
Vestibulum congue
tempus
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor.
● Data Model – In Firebase Real-time Database stores data in a large JSON tree. In Cloud Firestore, data is stored as a
collection of documents. You can use subcollection in the documents. Cloud Firestore requires less normalization.
● Real-time and Online Support – Real-time Database: Offline support only for mobile (Android & iOS) devices. Cloud
Firestore: Offline support for mobile (Android & iOS), web clients as well.
● Querying - Real-time Database: You can use deep queries. But have some limitations on filtering and sorting the
functionalities. Cloud Firestore: You can use index queries with good compound filtering and sorting. You can use sorting,
combine filtering and chain filter on every property in one single query.
● Scalability - In real-time database, the scaling process is not automatic, we have to scale on your own. In the Cloud
Firestore Scaling process is automatic. Firebase does it on their own.
CLOUD FIRESTORE VS. REALTIME DATABASE
Creating Firebase Project
Flutter with Firebase
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
What is Flutter?
Flutter is Google’s UI toolkit for building beautiful, natively compiled
applications for mobile, web, and desktop from a single codebase.
● First announced as stable at December 2018
● Key values:
○ Fast Development
○ Expressive and Flexible UI
○ Native Performance
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
Firestore MENA digital days : GDG Abu dhabi
https://pub.dev/
Words Of Wisdom - Quotes App
C - Create
R - Read
U - Update
D - Delete
Firestore Operations
Future addUserToFirebaseDB(FirebaseUser data) async {
try {
return await Firestore.instance
.collection('users')
.document(data.email.toString())
.setData(
{'email': data.email, 'name': data.displayName });
} catch (e) {
print(e);
}
}
FirebaseUser user = await GoogleLogin.signInWithGoogle();
addUserToFirebaseDB(user).then((value) {
setState(() {
isLoading = false;
});
Navigator.pushReplacement(
context, CupertinoPageRoute(builder: (context) => QuotesPage(true)));
});
Login and Create
StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('quotes').snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return new CircularProgressIndicator();
default:
return PageView.builder(
scrollDirection: Axis.horizontal,
itemCount: snapshot.data.documents.length,
itemBuilder: (context, position) {
final document = snapshot.data.documents[position];
Read with StreamBuilder
(widget with which we can convert network streams into UI objects)
Future addQuotesToFirebaseDB() async {
try {
String author = authorController.text.toString();
String quote = quotesController.text.toString();
final collRef = Firestore.instance.collection('quotes');
DocumentReference docReference = collRef.document();
return await docReference.setData(
{'author': author, 'quote': quote, 'id': docReference.documentID});
} catch (e) {
print(e);
}
}
Addition of Document
Future updatePostClap(String postID, count) async {
try {
await Firestore.instance
.collection('posts')
.document(postID.toString())
.updateData({
'clapCount': int.parse(count),
});
} catch (e) {
print(e);
}
}
Update
Simple and Compound Queries : Indexing
await Firestore.instance
.collection("posts")
.where("language", isEqualTo: lang)
.orderBy("clapCount", descending: true)
.orderBy("timestamp", descending: true)
.getDocuments()
.then((QuerySnapshot snapshot) {
snapshot.documents.forEach((element) {
listOfPost.add(PostContent.fromFirestore(element));
});
});
Securing Firestore : Database Rules
Securing Firestore : Database Rules
Securing Firestore : Database Rules
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth.token.email == userId;
}
match /languages/{document=**} {
allow read, write: if request.auth.uid != null;
}
match /posts/{document=**} {
allow read, write: if request.auth.uid != null;
}
match /sections/{document=**} {
allow read, write: if request.auth.uid != null;
}
}
}
Database Usage Insites
Firebase pricing plans
https://firebase.google.com/pricing?authuser=0
Resources & References
Firebase docs : https://firebase.google.com/docs
Cloud Firestore docs : https://firebase.google.com/docs/firestore
Code References for Quotes App :
https://github.com/shashankkaroo/WordsOfWisdom-Quotes-App
Candid Feeds App : https://play.google.com/store/apps/details?id=com.candidfeeds&hl=en
Getting started with Flutter : https://flutter.dev/docs
Sample Flutter Projects for References : https://itsallwidgets.com/
Udacity Free courses for Flutter :
https://www.udacity.com/course/build-native-mobile-apps-with-flutter--ud905
Shashank Kakroo
shashankkakroo@gmail.com
GDG Abu Dhabi, UAE
Thank You!

More Related Content

PDF
Big query the first step - (MOSG)
PDF
Jump into cross platform development with firebase
PDF
Google BigQuery
PDF
Google Big Query UDFs
PDF
Getting started with BigQuery
PPTX
Using the Google Cloud -for Developers- part four
PDF
Complex realtime event analytics using BigQuery @Crunch Warmup
PPTX
Data Science using Google Cloud BigQuery, Python and Power BI
Big query the first step - (MOSG)
Jump into cross platform development with firebase
Google BigQuery
Google Big Query UDFs
Getting started with BigQuery
Using the Google Cloud -for Developers- part four
Complex realtime event analytics using BigQuery @Crunch Warmup
Data Science using Google Cloud BigQuery, Python and Power BI

What's hot (19)

PDF
Crunching Data with Google BigQuery. JORDAN TIGANI at Big Data Spain 2012
PPTX
30 days of Google Cloud Introduction
PPTX
G suite apps
PDF
Google BigQuery for Everyday Developer
PDF
Big query
PDF
Google Cloud Platform 2014Q1 - Starter Guide
PDF
BigQuery for Beginners
PDF
Using Google (Cloud) APIs
PDF
Backend asa service - juan
PDF
iOS 8 and iPhone 6 for web developers and designers
PDF
30 Days Of Google Cloud Info Session-GDSC AU
PDF
Custom Paging with GridView
PPTX
Html indexed db
PDF
Exploring Google (Cloud) APIs & Cloud Computing overview
PPTX
Building event-driven Serverless Apps with Azure Functions and Azure Cosmos DB
PPTX
Social Analytics on MongoDB at MongoNYC
KEY
Google App Engine with Gaelyk
PDF
Serverless computing with Google Cloud
PPTX
"Implementing an Event Sourcing strategy on Azure", Olena Borzenko/Eldert Gro...
Crunching Data with Google BigQuery. JORDAN TIGANI at Big Data Spain 2012
30 days of Google Cloud Introduction
G suite apps
Google BigQuery for Everyday Developer
Big query
Google Cloud Platform 2014Q1 - Starter Guide
BigQuery for Beginners
Using Google (Cloud) APIs
Backend asa service - juan
iOS 8 and iPhone 6 for web developers and designers
30 Days Of Google Cloud Info Session-GDSC AU
Custom Paging with GridView
Html indexed db
Exploring Google (Cloud) APIs & Cloud Computing overview
Building event-driven Serverless Apps with Azure Functions and Azure Cosmos DB
Social Analytics on MongoDB at MongoNYC
Google App Engine with Gaelyk
Serverless computing with Google Cloud
"Implementing an Event Sourcing strategy on Azure", Olena Borzenko/Eldert Gro...
Ad

Similar to Firestore MENA digital days : GDG Abu dhabi (20)

PPTX
Firebase integration with Flutter
PDF
19-03-22.pdf
PPTX
Firebase .pptx
PPTX
Flutter-Festivals Day-4.pptx
PDF
Flutter Festival IIT Goa: Session IV
PDF
Intro to Firebase || Event by DSC UNIDEB
PDF
Google Firebase presentation - English
PDF
Flutter and Firebase – A Helpful Blend for Your Business App
PDF
10 03-2022
PPTX
Tech Winter Break - GDG OnCampus International Institute of Information Techn...
PDF
Online mobile game server use Firebase realtime aatabase
PDF
Firebase in action 2021
PPT
PPTX
Advance Mobile Application Development class 04
PPTX
Firebase 101 - Firebase Guide Zero to Hero
PPTX
Google Firebase Presentation
PPTX
Google Firebase
PPTX
Building a Google Cloud Firestore API with dotnet core
PPTX
GoogleDSC_ GHRCE_ flutter_firebase.pptx
PDF
Firestore czyli ognista baza od giganta z Doliny Krzemowej
Firebase integration with Flutter
19-03-22.pdf
Firebase .pptx
Flutter-Festivals Day-4.pptx
Flutter Festival IIT Goa: Session IV
Intro to Firebase || Event by DSC UNIDEB
Google Firebase presentation - English
Flutter and Firebase – A Helpful Blend for Your Business App
10 03-2022
Tech Winter Break - GDG OnCampus International Institute of Information Techn...
Online mobile game server use Firebase realtime aatabase
Firebase in action 2021
Advance Mobile Application Development class 04
Firebase 101 - Firebase Guide Zero to Hero
Google Firebase Presentation
Google Firebase
Building a Google Cloud Firestore API with dotnet core
GoogleDSC_ GHRCE_ flutter_firebase.pptx
Firestore czyli ognista baza od giganta z Doliny Krzemowej
Ad

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Pre independence Education in Inndia.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Business Ethics Teaching Materials for college
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Classroom Observation Tools for Teachers
Pre independence Education in Inndia.pdf
Insiders guide to clinical Medicine.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Business Ethics Teaching Materials for college
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Supply Chain Operations Speaking Notes -ICLT Program
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Anesthesia in Laparoscopic Surgery in India
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Basic Mud Logging Guide for educational purpose
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

Firestore MENA digital days : GDG Abu dhabi

  • 1. Shashank Kakroo GDG Abu Dhabi, UAE Introduction to Firebase : Firestore with Flutter
  • 4. No registration needed Qwiklabs Code: bit.ly/menadd-apr Feedback: bit.ly/menadd-feedback Weekly challenge: bit.ly/menadd-challenge MENA Digital Days - Together we learn! Join us YouTube.com/c/GDGMENA Website: bit.ly/menadd-website Each week Sunday-Thursday 7-11pm (Dubai Time) Content: 20+ LIVE workshops, Talks, & hackathons Speakers: Googlers, Experts & 200+ communities. Stay Home! Stay Safe! Keep learning!
  • 5. Two more things ✌ Help us improve this initiative 1. ATTENDANCE CERTIFICATE weekly after filling feedback bit.ly/menadd-feedback 2. JOIN MENA DIGITAL DAYS CHALLENGE … bit.ly/menadd-challenge (Code: bit.ly/menadd-apr) All winners who solve 6 quests this week Wins SPECIAL GIFT BOX! 🎁 All winners who solve 12 quests this week Wins Google Home Mini 🤩
  • 6. Agenda for Today ● Introduction to Firebase ● Brief about Firebase products ● Cloud Firestore Database ● Introduction to Flutter ● Setup firebase and flutter project ● CRUD Operations with Firebase & Flutter ● Sample App with Code references
  • 8. Firebase is google’s app development platform ● Abstracts any typical backend platform. ● Complete package for all app development needs. ● Works well with Node, Python, Java etc. on many platforms like android, ios and web. ● Well documented and easy to adopt. ● Free for small experiments and scales according to user growth. ● Has many products which can be used independently or in combination according to your development needs.
  • 12. Cloud Firestore is a NoSQL document database that lets you easily store, sync, and query data for your mobile and web apps - at global scale. ● Its a document database, stores data in form of big tree like structures but all in form of documents and collections. Vestibulum congue tempus Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.
  • 13. Cloud Firestore is a NoSQL document database that lets you easily store, sync, and query data for your mobile and web apps - at global scale. Vestibulum congue tempus Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.
  • 14. Vestibulum congue tempus Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. ● Data Model – In Firebase Real-time Database stores data in a large JSON tree. In Cloud Firestore, data is stored as a collection of documents. You can use subcollection in the documents. Cloud Firestore requires less normalization. ● Real-time and Online Support – Real-time Database: Offline support only for mobile (Android & iOS) devices. Cloud Firestore: Offline support for mobile (Android & iOS), web clients as well. ● Querying - Real-time Database: You can use deep queries. But have some limitations on filtering and sorting the functionalities. Cloud Firestore: You can use index queries with good compound filtering and sorting. You can use sorting, combine filtering and chain filter on every property in one single query. ● Scalability - In real-time database, the scaling process is not automatic, we have to scale on your own. In the Cloud Firestore Scaling process is automatic. Firebase does it on their own. CLOUD FIRESTORE VS. REALTIME DATABASE
  • 21. What is Flutter? Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. ● First announced as stable at December 2018 ● Key values: ○ Fast Development ○ Expressive and Flexible UI ○ Native Performance
  • 26. Words Of Wisdom - Quotes App C - Create R - Read U - Update D - Delete Firestore Operations
  • 27. Future addUserToFirebaseDB(FirebaseUser data) async { try { return await Firestore.instance .collection('users') .document(data.email.toString()) .setData( {'email': data.email, 'name': data.displayName }); } catch (e) { print(e); } } FirebaseUser user = await GoogleLogin.signInWithGoogle(); addUserToFirebaseDB(user).then((value) { setState(() { isLoading = false; }); Navigator.pushReplacement( context, CupertinoPageRoute(builder: (context) => QuotesPage(true))); }); Login and Create
  • 28. StreamBuilder<QuerySnapshot>( stream: Firestore.instance.collection('quotes').snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) return new Text('Error: ${snapshot.error}'); switch (snapshot.connectionState) { case ConnectionState.waiting: return new CircularProgressIndicator(); default: return PageView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data.documents.length, itemBuilder: (context, position) { final document = snapshot.data.documents[position]; Read with StreamBuilder (widget with which we can convert network streams into UI objects)
  • 29. Future addQuotesToFirebaseDB() async { try { String author = authorController.text.toString(); String quote = quotesController.text.toString(); final collRef = Firestore.instance.collection('quotes'); DocumentReference docReference = collRef.document(); return await docReference.setData( {'author': author, 'quote': quote, 'id': docReference.documentID}); } catch (e) { print(e); } } Addition of Document
  • 30. Future updatePostClap(String postID, count) async { try { await Firestore.instance .collection('posts') .document(postID.toString()) .updateData({ 'clapCount': int.parse(count), }); } catch (e) { print(e); } } Update
  • 31. Simple and Compound Queries : Indexing await Firestore.instance .collection("posts") .where("language", isEqualTo: lang) .orderBy("clapCount", descending: true) .orderBy("timestamp", descending: true) .getDocuments() .then((QuerySnapshot snapshot) { snapshot.documents.forEach((element) { listOfPost.add(PostContent.fromFirestore(element)); }); });
  • 32. Securing Firestore : Database Rules
  • 33. Securing Firestore : Database Rules
  • 34. Securing Firestore : Database Rules service cloud.firestore { match /databases/{database}/documents { match /users/{userId} { allow read, write: if request.auth.token.email == userId; } match /languages/{document=**} { allow read, write: if request.auth.uid != null; } match /posts/{document=**} { allow read, write: if request.auth.uid != null; } match /sections/{document=**} { allow read, write: if request.auth.uid != null; } } }
  • 37. Resources & References Firebase docs : https://firebase.google.com/docs Cloud Firestore docs : https://firebase.google.com/docs/firestore Code References for Quotes App : https://github.com/shashankkaroo/WordsOfWisdom-Quotes-App Candid Feeds App : https://play.google.com/store/apps/details?id=com.candidfeeds&hl=en Getting started with Flutter : https://flutter.dev/docs Sample Flutter Projects for References : https://itsallwidgets.com/ Udacity Free courses for Flutter : https://www.udacity.com/course/build-native-mobile-apps-with-flutter--ud905