我正在尝试从Firestore获取数据。该代码在FutureBuilder ListView
中正常工作。我尝试将所有条目打印到控制台。下面的代码工作正常,但仅打印前10个左右的条目。
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;
}
我想将所有300个条目打印在控制台中。有人可以帮我吗?
答案 0 :(得分:1)
尝试使用此 debugPrint 代替 print
debugPrint(list.toString(), wrapWidth: 1024);
或添加此方法和
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)));
}
致电
printWrapped(list.toString());
检查this以获得更多信息。