Query based off result of another query

I am trying to make a dropdown button that has a list of names. The dropdown should show the name of the athletes for the teams. However, the dropdown is only showing the UID. I am unable to have it query the accounts by the UID to pull the proper name.

Im trying to do the first query to get the list of UIDs, then perform another query inside after I get the UID. I then take that UID to perform the second query on the accounts to then grab the first name value.

I’ve tried doing nested FutureBuilders and use Future.wait, can’t seem to get anything to get the proper result.

FutureBuilder(
  future: database.reference().child("teams").child("TID1").child("athletes").once(),
  builder: (context, AsyncSnapshot<DataSnapshot> snapshot) {
    if(snapshot.hasData) {
      aKeys.clear();
      Map<dynamic, dynamic> values = snapshot.data.value;
      values.forEach((key, value) {
        database.reference().child("accounts").child(value).once();
        if (snapshot.hasData) {
          Map<dynamic, dynamic> nameValues = snapshot.data.value;
          nameValues.forEach((key, value) {
            aNames.add(
              DropdownMenuItem<dynamic>(
                child: Text(value["first name"]),
                value: key,
              )
            );
          });
        }
      });
      return Material(
        color: Colors.white,
        child: DropdownButtonHideUnderline(
          child: DropdownButton(
            items: aNames,
            hint: Text("Select an athlete"),
            value: _athlete,
            onChanged: (value) {
              setState(() {
                _athlete = value;
              });
            },
          ),
        ),
      );
    }
    return CircularProgressIndicator();
  }
),
{
    "accounts" :{
        "UID1" : {
            "first name" : "bob",
            "last name" :  "rogers"
        },
        "UID2" : {
            "first name" : "john",
            "last name" : "smith"
        },
        "UID3" : {
            "first name" : "tim",
            "last name" : "murr"
        },
        "UID4" : {
            "first name" : "larry",
            "last name" : "dean"
        }
    },
    "teams" : {
        "TID1" : {
            "athletes" : {
                "A1" : "UID1",
                "A2" : "UID2"
            }
        },
        "TID2" : {
            "athletes" : {
                "A1" : "UID3",
                "A2" : "UID4"
            }
        }
    }
}