I have a Users Collection in Firestore that contains a map field named biometric_data, which stores biometric details of the user (e.g., age, height, weight, gender). During the initial profile setup, the user must enter this data before proceeding.
To ensure this, I use a TextField that should only be visible if age (inside biometric_data) is null. I implemented this using Conditional Visibility in FlutterFlow. However, the field never becomes visible, even though age is not set in Firestore. Instead the default value of the text gets shown that should display the corresponding value when the field is not null.
Unexpected Behavior in Test Mode
• Even though I did not set a default value in the FlutterFlow data schema, I noticed that all Integer fields inside biometric_data (like age, height, weight) automatically default to 0 when testing in Test Mode.
• The Conditional Visibility does not trigger, because age is never actually null, but rather 0, even though I never explicitly assigned it a value.
• When I check the Firestore User document, age is not present in Firestore at all, yet in Test Mode, it appears as 0.
• This means that FlutterFlow somehow assigns default values to these map fields in Test Mode, even when they do not exist in Firestore.
Attachments
• Screenshot showing that the TextField does not appear despite the condition.
• Screenshot showing that Integer fields default to 0 in Test Mode, even though they do not exist in the actual Firestore document.
• Screenshot of my Data Type settings in FlutterFlow, where no default values were assigned.
Question
Is this expected behavior in FlutterFlow? If not, how can I ensure that these fields remain null in Test Mode instead of defaulting to 0, so that my Conditional Visibility logic works correctly?
Additionally, how can I correctly implement the logic so that:
1. If the user has not entered a value yet, the TextField is shown to allow input.
2. If the user has already entered a value, the existing value is displayed instead of the TextField.