Extracting a large number (about 300) documents from a firebase firestore db collection

折月煮酒 提交于 2020-04-17 22:10:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!