Skip to content

Instantly share code, notes, and snippets.

@timbergus
Created June 15, 2019 22:39
Show Gist options
  • Save timbergus/101fd59f8550a0926d90cea366474905 to your computer and use it in GitHub Desktop.
Save timbergus/101fd59f8550a0926d90cea366474905 to your computer and use it in GitHub Desktop.
body: StreamBuilder(
stream: Firestore.instance
.collection('feed')
.where('email', isEqualTo: 'user@fakemailaddress.com')
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Text('Loading...');
}
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) {
return Container(
height: 50,
padding: EdgeInsets.only(
left: 20,
),
alignment: Alignment.centerLeft,
color: index % 2 == 0 ? Colors.yellow[100] : Colors.white,
child: Text(
'${snapshot.data.documents[index]['message']}',
style: TextStyle(
fontSize: 20,
),
),
);
},
);
},
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment