问题
I am trying to get data from firestore. The code is working fine in FutureBuilder ListView.I tried printing all the entries to console. The code below is working fine but only printing first 10 or so entries.
Future getP() async {
var firestore = Firestore.instance;
var q = await firestore.collection('place_list').getDocuments();
List<Map<String, dynamic>> list = q.documents.map((DocumentSnapshot doc) {
return doc.data;
}).toList();
print(list);
return q.documents;
}
I want to get all 300 entries to be printed in console. Can anyone help me out in this?
回答1:
Try this debugPrint instead of print
debugPrint(list.toString(), wrapWidth: 1024);
or add this method and
void printWrapped(String text) {
final pattern = new RegExp('.{1,800}'); // 800 is the size of each chunk
pattern.allMatches(text).forEach((match) => print(match.group(0)));
}
call
printWrapped(list.toString());
Check this for further information.
来源:https://stackoverflow.com/questions/60411928/extracting-a-large-number-about-300-documents-from-a-firebase-firestore-db-col