Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search screen not displaying anything when I search #23

Closed
sharmahal opened this issue Jul 21, 2020 · 10 comments
Closed

Search screen not displaying anything when I search #23

sharmahal opened this issue Jul 21, 2020 · 10 comments

Comments

@sharmahal
Copy link

sharmahal commented Jul 21, 2020

initially my code was working fine but after working more on the project , I got this error
[NoSuchMethodError: The method 'where' was called on null.
Receiver: null
Tried calling: where(Closure: (User) => bool)
See also:
https://flutter.dev/docs/testing/errors]

then I changed my a funtion and wrote this -
` buildSuggestions(String query) {
final List suggestionList = query.isEmpty
? []
: userList != null
? userList.where((User user) {
String _getUsername = user.username.toLowerCase();
String _query = query.toLowerCase();
String _getName = user.name.toLowerCase();
bool matchesUsername = _getUsername.contains(_query);
bool matchesName = _getName.contains(_query);

  return (matchesUsername || matchesName);

  // (User user) => (user.username.toLowerCase().contains(query.toLowerCase()) ||
  //     (user.name.toLowerCase().contains(query.toLowerCase()))),
}).toList()
    : [];`

but still the search screen doesnt display the user it used to display intially

@AjayKannan97
Copy link

I am getting the same error. Did you figure it out?

@12amansharma
Copy link

Try copying the code from the repository as it is , it will work.

@AjayKannan97
Copy link

I tried that. Still the problem persists.

@takiuddin93
Copy link

takiuddin93 commented Jul 23, 2020

try clearing everything from database..

#3 (comment)

@sharmahal
Copy link
Author

clearing everything from database did not work for me

@sharmahal
Copy link
Author

try clearing everything from database..

#3 (comment)

didnt work for me

@AjayKannan97
Copy link

W/Firestore( 9173): (21.3.0) [FirestoreCallCredentials]: Failed to get token: com.google.firebase.firestore.FirebaseFirestoreException: getToken aborted due to token change.

Before searching, as soon as you click the search button in the home page, I am getting this error in the terminal.

@AjayKannan97
Copy link

https://stackoverflow.com/questions/52513691/firebase-js-error-gettoken-aborted-due-to-token-change

I fixed it by modifying the database rules.

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read; allow write; } } }

This should set it right.

@sharmahal
Copy link
Author

https://stackoverflow.com/questions/52513691/firebase-js-error-gettoken-aborted-due-to-token-change

I fixed it by modifying the database rules.

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read; allow write; } } }

This should set it right.

This worked for me, thank you so much

@arifjawad
Copy link

https://stackoverflow.com/questions/52513691/firebase-js-error-gettoken-aborted-due-to-token-change

I fixed it by modifying the database rules.

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read; allow write; } } }

This should set it right.

this worked for me too, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants