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

flash-chat, chat_screen problem #54

Open
MdRubayat opened this issue Jun 5, 2021 · 8 comments
Open

flash-chat, chat_screen problem #54

MdRubayat opened this issue Jun 5, 2021 · 8 comments

Comments

@MdRubayat
Copy link

Screen Shot 2021-06-06 at 12 04 36 AM
Screen Shot 2021-06-06 at 12 01 52 AM
can anyone please help me with this problem?

@aswin-remesan
Copy link

I don't see an " _firestore " variable defined here.... that is the main issue here.
Also, I think you meant to use " firestore.collection{'messages'}.snapshots() " in line 107... just remove the underscore and try it again " _ "

Also, see line 14, that's how you've defined/declared firestore variable.

@MdRubayat
Copy link
Author

Thanks all the problems are solved except for line 116 >>
"final messages = snapshot.data.documents.reversed;" it says
error: The getter 'documents' isn't defined for the type 'QuerySnapshot'. (undefined_getter at [flash_chat] lib/screens/chat_screen.dart:120)

@aswin-remesan
Copy link

try the same line with " s " removed from "documents"

" final messages = snapshot.data.document.reversed; "

@MdRubayat
Copy link
Author

@aswin-remesan brother i tried but it didn't worked though

@aswin-remesan
Copy link

@aswin-remesan brother i tried but it didn't worked though

https://stackoverflow.com/questions/57584317/messages-on-flutter-chat-app-not-in-proper-order

See this... I think you are facing the same issue... They've found a solution
Go through it

@nagen1
Copy link

nagen1 commented Jun 8, 2021

Screen Shot 2021-06-06 at 12 04 36 AM
Screen Shot 2021-06-06 at 12 01 52 AM
can anyone please help me with this problem?

as I see their are 2 things from your screenshot.
2 variables are not defined in Errors section and your trying to use them in Snapshot stream.

to solve the problem.

  1. Define a variable like this. you can declare this variable as global or local to specific widget/chat_screen.dart file
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
final FirebaseAuth _auth = FirebaseAuth.instance;
  1. Use the same variable in snapshot section to stream the data in chat screen/message bubble.
    _firestore.collection('messages').snapshots()

once you defined the variable and have access to _firestore object. the IDE will give you all kinds off methods that object can project.
like so.. messages = snapshot.data.docs.reversed;

@MdRubayat
Copy link
Author

@aswin-remesan brother i tried but it didn't worked though

https://stackoverflow.com/questions/57584317/messages-on-flutter-chat-app-not-in-proper-order

See this... I think you are facing the same issue... They've found a solution
Go through it

Thank you so much for helping me so throughly every time @aswin-remesan i deeply researched it and got the solution. This community is alive for people like you !

@MdRubayat
Copy link
Author

Thank you brother @nagen1 really appreciate your kind concern.

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

3 participants