3. Firebase Firestore
• Cloud Firestore is a flexible, scalable database for mobile, web, and server
development from Firebase and Google Cloud.
• NoSQL cloud database to store and sync data for client- and server-side
development.
Firestore Introduction
4. Firebase Firestore
• Firestore stores data within "documents", which are contained
within "collections".
Firestore Documents
11. Map method
The map() is a method of the Iterable class. The map() method creates a new
iterable object that contains all elements of the iterable that pass a test.
Syntax:
listvar_name.map(mapping_function);
12. void main() {
List<String> ls = ["GDSC", "Flutter", "Forward"];
List<int> newls = [];
for(String s in ls) {
newls.add(s.length);
}
print(newls);
}
void main() {
List<String> ls = ["GDSC","Flutter","Forward"];
List<int> newls = ls.map((e)=>e.length).toList();
print(newls);
}
Output:
[4, 7, 7]
13. Async and Await
Async/await is a feature in Dart that allows us to write asynchronous code that looks
and behaves like synchronous code, making it easier to read.
When a function is marked async, it signifies that it will carry out some work that could
take some time and will return a Future object that wraps the result of that work.
The await keyword, on the other hand, allows you to delay the execution of an async
function until the awaited Future has finished. This enables us to create code that
appears to be synchronous but is actually asynchronous.
14. Future<void> fetchUserOrder() {
// Imagine that this function is fetching user info from another service or
database.
return Future.delayed(
const Duration(seconds: 2), () => print('Order Placed'));
}
void main() async {
print('Fetching order status...');
await fetchUserOrder();
print(‘Details Fetched...');
}
Output:
Fetching order status...
Order Placed