diff --git a/packages/cloud_firestore/README.md b/packages/cloud_firestore/README.md index bfaba2d0fdf9..379a5a820924 100755 --- a/packages/cloud_firestore/README.md +++ b/packages/cloud_firestore/README.md @@ -47,20 +47,15 @@ class BookList extends StatelessWidget { return StreamBuilder( stream: Firestore.instance.collection('books').snapshots(), builder: (BuildContext context, AsyncSnapshot 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(), + ); }, ); }