About API data post

Hi, Flutter Flow

I have the companyClients drop-down in the form. I need to call the options from the API get method. The Api get method body looks like this

"data": {
        "companyClients": [
            {
                "_id": "64b6678af0032c5615b4e5d1",
                "name": "client 1"
            }
        ],
        "companySites": [
            {
                "_id": "64b7ad5adb197b902e7bd015",
                "name": "site 1"
            }
        ],
        "assetType": [
            "MOBILE",
            "FIXED",
            "PORTABLE"
        ],
}

When I fetch the data to dropdown I can get the Names. But I need to post my data to API I need to send the ID as the value not the Name because the Post API body looks like

{
    "assetId": "X2312BE",
    "companyClient": "64b6678af0032c5615b4e5d1",
    "companySite": "64b7ad5adb197b902e7bd015",
    "type": "FIXED",
    "zone": "AAAE",
    "equipmentType": "COMPRESSOR"
}

My UI looks as the Image attached. How can I pass the dropdown Values as the ID not the Name.

1
8 replies