null value on new chat

Troubleshooting

Sorry for the long question, but I gotta get this after like 30 hours of work lol.

I have an action flow that checks if there is a chat that exists between two users, and navigates to that chat or creates a new chat if it doesn't exist, respectively. The problem is that I am getting a null value error when I try to open the new chat. On local test I get a red screen of death (see below) but the chat is actually successfully created as seen on firebase, and it can be accessed after reloading the app....

my action flow:

  1. query to find a chat document between the users that already exists.

  2. check if a. the document exists, and b. it has two users and is therefore not a group chat... if both are true then we navigate to that document. (This works fine.)

  3. to create a new chat I first clear the app state I use to set the list of users

  4. then use parallel to set the 0 and 1 indexes of the chat's users list to auth user and the user we're messaging, respectively.

  5. Then I create a new chat document with the list of users and set user a, user b, etc.

  6. then navigate to chat and pass the above doc..... which is where I get the crashing null error. (first photo)

The weird thing is that I have this simple private/public account system where if a user is private, then other they have to accept follow requests from other users etc, just like Insta. For some reason this problem ONLY seems to appear when a public account is trying to start a NEW message with a PRIVATE account. Which doesn't make any sense because the logic for messaging is the same for both, its just that the message button becomes visible only when a public account is accepted by a private account. Maybe this is an illusion that it has anything to do with the bug but who knows... wondering what you guys think.

What makes this stranger and just really difficult to explain is that there is another message button that does the exact same flow a different place in the app that works just fine smh.

Maybe you guys can take a look at the flow and see if there is anything wrong with it, or is there something fringe, totally else that I may be missing?

appreciate it.

What have you tried so far?

24 hrs of looking over everything and trying different arrangements. Nothing yet.

Did you check FlutterFlow's Documentation for this topic?
Yes
3
1 reply