<kbd>
class _SearchState extends State<Search> {
TextEditingController searchController = TextEditingController();
Future<QuerySnapshot> searchResultsFuture; //The problem is here
handleSearch(String query) {
Future<QuerySnapshot> user =
usersRef.where("displayName", isGreaterThanOrEqualTo: query).get();
//.getDocuments()
setState(() {
searchResultsFuture = user;
});
}
</kbd>
Have used late Future searchResultsFuture;
and the highlighted error gone but the code didn’t work
2
Answers
use ? operator after QuerySnapshot or after this ( > )
Change
to
to make it nullable