Flutter FutureBuilder’s future never seems to complete
I’m new to Flutter and Dart, and I’m trying to build an app that allows users to sign in with Google and allows them to choose a Google Sheet to use with the app from the Google Sheets they have in their Drive. When the app starts, I perform the following asynchronous tasks for which I am using a FutureBuilder
–
Bad state: cannot get field “username” on a DocumentSnapshotPlatform which does not exist
FutureBuilder(
future:Future.value( FirebaseFirestore.instance.collection(‘users’).doc(userId).get(),),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Text(“Loading…”);
} else if (snapshot.hasError || snapshot.data == null) {
return const Text(“User not found”);
}