Created
January 22, 2021 08:45
-
-
Save littleironical/78113322e6b74e38a7fc847a831b04a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final CollectionReference items = FirebaseFirestore.instance.collection('Orders'); | |
final body = StreamBuilder<QuerySnapshot>( | |
stream: items.snapshots(), | |
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { | |
if (snapshot.hasError) { | |
return Container( | |
child: Center( | |
child: Text('SOME ERROR HAS OCCURED'), | |
), | |
); | |
} | |
if (snapshot.connectionState == ConnectionState.waiting) { | |
return Loading(); | |
} | |
return ListView( | |
children: snapshot.data.docs.map((DocumentSnapshot document) { | |
return new ListTile( | |
title: Text( | |
document.data()['Name'], | |
style: TextStyle(color: Colors.white), | |
), | |
leading: Text( | |
document.data()['Price'], | |
style: TextStyle(color: Colors.white), | |
), | |
); | |
}).toList(), | |
); | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment