Skip to content

Instantly share code, notes, and snippets.

@sirateek
Created March 7, 2020 09:14
Show Gist options
  • Save sirateek/83f11cd5b2cbc2cbf8aace80041795ca to your computer and use it in GitHub Desktop.
Save sirateek/83f11cd5b2cbc2cbf8aace80041795ca to your computer and use it in GitHub Desktop.
StreamBuilder(
stream: Firestore.instance.collection("catalog").snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: Column(
children: <Widget>[
CircularProgressIndicator(),
Text("Loading . . . "),
],
),
);
} else {
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Container(
child: InkWell(
onTap: () {},
child: Column(
children: <Widget>[
ListTile(
title: Text(
snapshot.data.documents[index].documentID),
subtitle: Text(snapshot
.data.documents[index].data["description"]),
),
],
),
),
),
),
);
},
);
}
},
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment