В настоящее время я использую этот код для отображения всего списка задач todo:
return new StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('todo_list').snapshots,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return new Text('Loading...');
return new ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
document['status'] == true ?
new ListTile(
title: new Row(
children: <Widget>[
new Expanded(
child: new Text(document['task'],
style: new TextStyle(
decoration: TextDecoration.lineThrough,
),
),
)
],
)
) : new Text("");
}).toList(),
);
},
);
Я хочу, чтобы задачи, которые имеют статус, были истинными. Однако при этом возникает ошибка:
I/flutter (21800): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (21800): The following assertion was thrown during performLayout():
I/flutter (21800): 'package:flutter/src/widgets/sliver.dart': Failed assertion: line 291 pos 12: 'child != null': is
I/flutter (21800): not true.
I/flutter (21800):
I/flutter (21800): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (21800): more information in this error message to help you determine and fix the underlying cause.
I/flutter (21800): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (21800): https://github.com/flutter/flutter/issues/new
I/flutter (21800):
I/flutter (21800): When the exception was thrown, this was the stack:
I/flutter (21800): #2 SliverChildListDelegate.build (package:flutter/src/widgets/sliver.dart)
I/flutter (21800): #3 SliverMultiBoxAdaptorElement._build.<anonymous closure> (package:flutter/src/widgets/sliver.dart:716:67)
I/flutter (21800): #4 _HashMap.putIfAbsent
...
Есть предложения?