Retrieving Data Using DocumentSnapshot
Retrieve Data Stored in a map in firebase
First, Add dependencies:
dependencies:
cloud_firestore: ^1.0.7
Now, run an implicit
Note: Install the latest version.
dart pub get
.Note: Install the latest version.
Import it
Now in your Dart code, you can use:
Now in your Dart code, you can use:
import 'package:cloud_firestore/cloud_firestore.dart';
Now in your Dart code:Also, to get data length use:DocumentSnapshot documentSnapshot = await FirebaseFirestore.instance.collection('Collection_Name').doc('Document_Id').get();
int dataLength = documentSnapshot.data().length;
To get data of a single map:
List<String> dataList = documentSnapshot['key'].toString();
For queries or any other help related to flutter or dart feel free to ask in the comments😊
Comments
Post a Comment