title: How do implement a DropdownButton using Getx in Flutter
body: <p>I am trying to implement a DropdownButton with two dropdownmenuitems, spanish and english.</p>
  <p>I want a user to select a language and will send this back to getx translations in order to change the app's language.</p>
  <p>Here is my controller:</p>
  <pre><code>import 'package:get/get.dart';
  
  class DropdownController extends GetxController {
    String selectedValue;
  
    var language = &lt;String&gt;['English', 'Espanol'];
  
    void onSelected(String value) {
      selectedValue = value;
    }
  }
  </code></pre>
  <p>Here is my settings page</p>
  <pre><code>class SettingsScreen extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return GetBuilder&lt;DropdownController&gt;(builder: (controller) {
        return Scaffold(
          body: Column(children: [
            Text('Select Language: '),
            SizedBox(height: 10.0),
            DropdownButton&lt;String&gt;(
                hint: Text('Language'),
                value: controller.selectedValue,
                onChanged: (newValue) {
                  controller.onSelected(newValue);
                },
                elevation: 10,
                items: [
                  DropdownMenuItem(
                    child: Text(&quot;English&quot;),
                    value: controller.selectedValue,
                  ),
                  DropdownMenuItem(
                    child: Text(&quot;ESpanol&quot;),
                    value: controller.selectedValue,
                  ),
                ]),
          ]),
        );
      });
    }
  }
  </code></pre>