Skip to content

Commit

Permalink
Revert "Correct usage of StreamBuilder (flutter#759)"
Browse files Browse the repository at this point in the history
This reverts commit 4b71aff.
  • Loading branch information
andreidiaconu committed Feb 17, 2019
1 parent bccdc3c commit 76eebdc
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions packages/cloud_firestore/README.md
Expand Up @@ -47,20 +47,15 @@ class BookList extends StatelessWidget {
return StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('books').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
switch (snapshot.connectionState) {
case ConnectionState.waiting: return new Text('Loading...');
default:
return new ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
return new ListTile(
title: new Text(document['title']),
subtitle: new Text(document['author']),
);
}).toList(),
if (!snapshot.hasData) return Text('Loading...');
return ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
return ListTile(
title: Text(document['title']),
subtitle: Text(document['author']),
);
}
}).toList(),
);
},
);
}
Expand Down

0 comments on commit 76eebdc

Please sign in to comment.