title: Send DropDown value to API Flutter
body: <p>I have some Data coming from my API and is displayed in a DropDownButton. My problem is I can't send back the selected value to the API when the submit button is pressed.</p>
  <blockquote>
  <p>Here I do the register HTTP call</p>
  </blockquote>
  <pre><code>  Future&lt;Map&gt; register(String name, String email, String budget,
    String currency, String password, String confirmPassword) async {
    final url = &quot;$api/register&quot;;
  
    var body = {
    'name': name,
    'email': email,
    'budget': budget,
    'currency': currency,
    'password': password,
    'confirmPassword': confirmPassword,
    };
  
    Map&lt;String, dynamic&gt; result = {
    &quot;success&quot;: false,
    &quot;message&quot;: 'Unknown error.'
    };
  
    final response = await dio.post(
    url,
    data: body,
    );
  
    if (response.statusCode == 201) {
    notifyListeners();
    result['success'] = true;
  
    return result;
   }
   Map apiResponse = response.data;
   _status = Status.Authenticated;
  
    _token = apiResponse['token'];
    print(_token);
    await storeUserData(apiResponse);
  
    if (response.statusCode == 422) {
    if (apiResponse['errors'].containsKey('email')) {
      result['message'] = apiResponse['errors']['email'][0];
      return result;
    }
  
    if (apiResponse['errors'].containsKey('password')) {
      result['message'] = apiResponse['errors']['password'][0];
      return result;
    }
  
    return result;
   }
  
   return result;
   }
  </code></pre>
  <blockquote>
  <p>This is the post function that I'm calling in the UI</p>
  </blockquote>
  <pre><code>    Future&lt;void&gt; submit() async {
    final form = _formKey.currentState;
    if (form.validate()) {
      response = await Provider.of&lt;AuthProvider&gt;(context, listen: false)
          .register(name, email, budget, currency, password, confirmPassword);
      if (response['success']) {
        print(&quot;Signed Up Successfuly&quot;);
        showAlertDialogWithActions(
            &quot;Signed Up Successfuly, Please Sign in to continue&quot;, context);
      } else {
        setState(() {
          message = response['message'];
        });
      }
    }
    }
  </code></pre>
  <p><strong>DropDown Button</strong></p>
  <pre><code>     DropDownInput(
                        validator: (value) {
                          currency = selectedValue;
                          return Validate.requiredField(
                              value, 'Budget is required.');
                        },
                        width: 150,
                        hint: &quot;Currency&quot;,
                        items: currencyItemList.map((item) {
                          return DropdownMenuItem(
                              child: Text(item['currencyName']),
                              value: item['_id'].toString());
                        }).toList(),
                        onChange: (newVal) {
                          setState(() {
                            selectedValue = newVal;
                          });
                        },
                        value: selectedValue, 
                      )
  </code></pre>
  <p>I want to send the <strong>SelectedValue</strong> to API using the <strong>validator</strong> I'm using above</p>