How to create dropown list in flutter where data comes from API?

You should try to this create your own tow API's 1. Select All Teachers 2. Get the subject of selected user.

  String sid;
  List data = List();
  String url = "https://example.com/teacher";
  //your all teacher api call
  Future fetchTeacher() async {
    var result = await http.get(url, headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    });
    var jsonData = json.decode(result.body);

    setState(() {
     data = jsonData;
    });
   return jsonData;
 }
 // add your API call with ininState() function
 @override
 void initState() {
   super.initState();
   fetchTeacher();
  }
  // Your Widget for All teachers dropdown list 
   DropdownButtonHideUnderline(
        child: DropdownButton(
          value: sid,
          hint: Text("Select Stockiest",
              style: TextStyle(color: Colors.black)),
          items: data.map((list) {
            return DropdownMenuItem(
              child: Text(list['name']),
              value: list['sid'].toString(),
            );
          }).toList(),
          onChanged: (value) {
            setState(() {
              sid = value;
            });
          },
        ),
      ),

Try Same API function for selected teacher subject the url like this:

String url = "https://example.com/teacher"+sid;

pass the id for above url for selected teacher and push this id for the your subject widget you get the selected teacher subject data