How to Display Field Content Using Field Names from an Array in Firebase

Database & APIs

Hi everyone,

I’ve run into an issue with displaying dynamic content, and I’m hoping someone here can help me out.

Here’s the situation: In my Firebase document, I have fields like field1, field2, and field3, and I also have an array selectedFields (e.g., ["field1", "field3"]), which contains the names of the fields I want to display dynamically.

I’ve set up a ListView to iterate through the selectedFields array and retrieve the field names. However, when I attempt to display the field values (e.g., the content of field1 or field3), FlutterFlow ends up showing the field names (like "field1" or "field3") instead of their corresponding values.

I’m looking for a way to dynamically use the field names from selectedFields to access and display their actual values in the same document.

Has anyone encountered a similar issue or found a solution? Any insights would be greatly appreciated. Thank you in advance! 😊"

What have you tried so far?

I tried using the names from selectedFields to dynamically fetch and display the values stored in the respective fields. I attempted this by configuring the Text widget in FlutterFlow to use the field names (Current Item) as dynamic keys to access the values within the same document. However, instead of displaying the values of these fields, it only shows their names (like field1 and field3).

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