I want after Login return me data to specific user. To get it i will do query which searches the documents for the ID that the user sent to the userId field automatically during registration but when i want to induce my query give me error: The argument type 'Future<QuerySnapshot<Map<String, dynamic>>>' can't be assigned to the parameter type 'Future<DocumentSnapshot<Object?>>?'
CodePudding user response:
What you're doing right now is fetching a collection of users that match on that criteria, which will return you a list (hence QuerySnapshot). If you want the single document associated with the logged in user (a DocumentSnapshot), you'd have to do:
FirebaseFirestore.instance.collection('users').doc(user!.uid).get()
which should return a Future with a DocumentSnapshot, and you can capture its data in the builder callback handler of the FutureBuilder via the snapshot provided in the callback.