Here’s a basic example of how to get data from Firestore Database:
FutureBuilder<QuerySnapshot>( future: FirebaseFirestore.instance.collection('Users').get(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) { return const Text('Something went wrong'); } if (snapshot.connectionState == ConnectionState.waiting) { return const Text("Loading"); } return ListView.builder( itemCount: snapshot.data?.docs.length, itemBuilder: (context, index) { final data = snapshot.data?.docs[index]; return ListTile( title: Text(data?['name'] ?? ''), subtitle: Text(data?['email'] ?? ''), trailing: Text(data?['dob'] ?? ''), ); }, ); }, )
StreamBuilder( stream: FirebaseFirestore.instance.collection('Users').snapshots(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasError) { return const Text('Something went wrong'); } if (snapshot.connectionState == ConnectionState.waiting) { return const Text("Loading"); } return ListView.builder( itemCount: snapshot.data?.docs.length, itemBuilder: (context, index) { final data = snapshot.data?.docs[index]; return ListTile( title: Text(data?['name'] ?? ''), subtitle: Text(data?['email'] ?? ''), trailing: Text(data?['dob'] ?? ''), ); }, ); }, )