Created
February 17, 2020 08:39
-
-
Save PeterHdd/cb96a48dbf9fb9ea6f4fb8b71523c0e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FutureBuilder( | |
future: dbRef.once(), | |
builder: (context, AsyncSnapshot<DataSnapshot> snapshot) { | |
if (snapshot.hasData) { | |
lists.clear(); | |
Map<dynamic, dynamic> values = snapshot.data.value; | |
values.forEach((key, values) { | |
lists.add(values); | |
}); | |
return new ListView.builder( | |
shrinkWrap: true, | |
itemCount: lists.length, | |
itemBuilder: (BuildContext context, int index) { | |
return Card( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text("Name: " + lists[index]["name"]), | |
Text("Age: "+ lists[index]["age"]), | |
Text("Type: " +lists[index]["type"]), | |
], | |
), | |
); | |
}); | |
} | |
return CircularProgressIndicator(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment