Critical Navigation Bug: DocumentReference parameter becomes Null on destination page, crashing the app.

Actions & Logic

Hello FlutterFlow Team,

I'm experiencing a critical and reproducible bug where a DocumentReference parameter, passed during a Navigate To action, consistently arrives as null on the destination page. This causes the page's main StreamBuilder to fail with an "Unexpected null value" error, crashing the app.

The issue is not a simple configuration error. I have definitively proven that the DocumentReference value is valid and not-null at the source, right before the navigation action is triggered.

Scenario:

  • Page A (DetallesTrabajador): Displays a list of patients documents in a ListView. Each item has a "View" button.

  • Page B (DetallesPaciente): Is supposed to display the details of a single patient, using a Document from Reference backend query that takes a DocumentReference page parameter.

The key evidence is this:
When I add an Alert Dialog action right before the Navigate To action to display the id of the document reference, the alert successfully shows the correct Document ID. However, upon closing the alert, the navigation proceeds and the app crashes with the red screen, proving the value is lost during the navigation event itself.

https://app.flutterflow.io/project/pacientes-andres-flow-dev-o5om4s

What have you tried so far?

I have exhausted all standard and advanced debugging methods available in FlutterFlow with no success. Here is a complete list of the steps I have taken:

  1. Verified Source Data: Used an Alert Dialog to display the .id of the DocumentReference from the ListView item right before navigation. Result: The correct ID is displayed, confirming the source data is valid.

  2. Recreated Navigation Action: I completely deleted the Navigate To action and recreated it from scratch, ensuring the DocumentReference from the list item was correctly mapped to the page parameter. Result: The error persists.

  3. Cleaned Destination Page: I identified a potentially conflicting StreamBuilder on the destination page (Page B) that was performing a separate user query. I removed this StreamBuilder entirely and replaced its logic with conditional visibility based on the Authenticated User global property. Result: The error persists.

  4. Duplicated Destination Page: To rule out a "corrupted page state" in the editor, I duplicated the destination page (Page B) and pointed the navigation to the new copy. Result: The error persists on the duplicated page.

  5. Bypassed Navigation Parameters with App State (Global Variable): This was the final test. I completely removed the page parameter from Page B.

    • On Page A: I created a new action flow: 1) Update App State to save the patient's DocumentReference to a new global appState variable, and then 2) Navigate To Page B (with no parameters).

    • On Page B: I changed the main backend query to get the Document from Reference from the App State variable instead of a page parameter.

    • Result: The error STILL persists. This is the most shocking part, as it indicates a fundamental issue with state management or page loading lifecycle in my specific project.

I am at a complete standstill. The fact that even the App State workaround fails suggests a very deep and unusual bug. Please advise. I can provide screenshots of the alert dialog, the red error screen, and my project setup if needed.

Thank you.

Did you check FlutterFlow's Documentation for this topic?
No
2
2 replies