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
room.lastMessages is Always null #25
Comments
Are you sure room at all is not empty? You need an index as described in the documentation comment for the
So you can see |
I did create an index. Hence the rooms are showing nicely and the recent active room always appear at the top... Which is awesome. I can see however lastMessages is always null NOT empty |
@mashegoindustries I understand, but is it null in the console? Why do you think this is a problem in the library and not in the cloud function which updates it? |
From console, it looks like Cloud functions has successfully updated last message. However from FirebaseChatCore dart class, I am not seeing any reference to lastMessages array. I think data exist in firestore, we are just not referencing the property lastMessages. I could be wrong |
Are you saying you don't see |
@demchenkoalex I started from scratch, followed the instructions , created firestore index. Using latest version of the plugins. Isn't the attached screenshot not the issue? lastMessages is never set Something like LINE 33 and LINE 68 is absent from the plugin itself |
LOL. How embarrassing :D sorry about that. You could have also done a PR with that so it would be released sooner. Will do now anyway. UPD: Dart can't manage |
I need this fix too. Running into error |
I tried the highlighted lines in the screenshot above with
and then while creating the room, I did
But issue is the lastMessage only has authorId and the toJson is failing because author property is null and it expected a types.User map |
That's correct. My thought is to create a json from the document data, replace fields like DateTime etc to match the underlying data, and the pass it to the |
Fixed in v1.3.0. |
I am streaming rooms using code below
FirebaseChatCore.instance.rooms(orderByUpdatedAt: true)
However it looks like lastMessages is always null
room.lastMessages
I am 100 percent sure that I have last messages on the rooms collection (Which is updated by cloud function)
The text was updated successfully, but these errors were encountered: