Created
March 25, 2022 08:21
-
-
Save aduquet/4ee969c2042b0263d5b7387481cb97d7 to your computer and use it in GitHub Desktop.
type 'Future<dynamic>' is not a subtype of type 'Stream<Object?>?'
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
I was dealing with | |
type 'Future<dynamic>' is not a subtype of type 'Stream<Object?>?' | |
I had no Future types in my app however I did have something like this: | |
getQuestion(String id, String collectionName) async { | |
//var collection = FirebaseFirestore.instance.collection(collectionName); | |
// var querySnapshots = await collection.get(); | |
// for (var snapshot in querySnapshots.docs) { | |
// var documentID = snapshot.id; | |
// print('++++++++++++++++++++++++++'); | |
// print(documentID); // <-- Document ID | |
// } | |
// final docsID = FirebaseFirestore.instance.collection(collectionName).doc(); | |
// print('++++++++++++++++++++++++++'); | |
// print(docsID); | |
// print(FirebaseFirestore.instance.collection(collectionName).doc()); | |
return FirebaseFirestore.instance | |
.collection(collectionName) | |
.doc(id) //ID OF DOCUMENT | |
.snapshots(); | |
} | |
} | |
I found that You cannot use async/await when returning from a build method (or a builder closure). | |
so the solution was to delate the async stament :D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment