title: Dropdown Button Usage in Flutter - Unhandled Exception: type 'double' is not a subtype of type 'int' of 'value'
body: <p>I'm trying to use a dropdown button to change some values and then using those values to change object properties and call object methods but im getting the following errors when i attempt to do so,</p>
  <pre><code>num glute_mev = 2;
  num glute_mv = 2;
  num glute_mrv_2x = 12;
  num glute_mrv_3x = 18;
  num glute_mrv_4x = 25;
  
  class Mesocycle {
  
    late num duration;
    late String mode;
    late num freq;
  
  // would prefer to not initialize but it gives an error if i dont
    late num gluteFreq;
    late String gluteMode = 'MAX'; 
    late num gluteIncrement = 1.0;
  
    List gluteExercises = &lt;String&gt;[];
    List gluteVolume = &lt;int&gt;[];
  
    generateGluteVolume() {
      //4 week mesocycle
      if (duration == 4 &amp;&amp; gluteMode != 'off') {
        gluteVolume.add(glute_mev);
        gluteVolume.add(glute_mev + gluteIncrement * 2);
        gluteVolume.add(glute_mev + gluteIncrement * 3);
        gluteVolume.add(glute_mev + (gluteIncrement * 3) / 3); //deload
      }
      //8 week mesocycle
      if (duration == 8 &amp;&amp; gluteMode != 'off') {
        gluteVolume.add(glute_mev);
        gluteVolume.add(glute_mev + gluteIncrement * 2);
        gluteVolume.add(glute_mev + gluteIncrement * 3);
        gluteVolume.add(glute_mev + gluteIncrement * 4);
        gluteVolume.add(glute_mev + gluteIncrement * 5);
        gluteVolume.add(glute_mev + gluteIncrement * 6);
        gluteVolume.add(glute_mev + gluteIncrement * 7);
        gluteVolume.add(glute_mev + (gluteIncrement * 7) / 3); //deload
      }
    }
  
    set_Freq(String group, num _freq) {
      if (group == 'glutes') {
        gluteFreq = _freq;
      }
    }
  
    set_Mode(String group, String _mode) {
      if (group == 'glutes') {
        gluteMode = _mode;
      }
    }
  
    set_gluteIncrement() {
      if (gluteFreq == 2) {
        gluteIncrement = (glute_mrv_2x - glute_mev) / (duration - 1);
      }
      if (gluteFreq == 3) {
        gluteIncrement = (glute_mrv_3x - glute_mev) / (duration - 1);
      }
      if (gluteFreq == 4) {
        gluteIncrement = (glute_mrv_4x - glute_mev) / (duration - 1);
      }
    }
  
    Mesocycle({
      required this.duration,
      required this.freq,
      required this.mode,
    });
  }
  
  void main() {
    runApp(MaterialApp(home: MesocycleView()));
  }
  // #endregion
  
  class MesocycleView extends StatefulWidget {
    const MesocycleView({Key? key}) : super(key: key);
  
    @override
    State&lt;MesocycleView&gt; createState() =&gt; _MesocycleViewState();
  }
  
  class _MesocycleViewState extends State&lt;MesocycleView&gt; {
    late String _gluteMode = 'MAX';
    var _gluteFreq;
    var _fontSize = 20.0;
  
    
    List&lt;String&gt; frequency = ['1', '2', '3', '4'];
  
  
    Mesocycle Meso1 = Mesocycle(
      duration: 8,
      freq: 2,
      mode: 'mass',
    );
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          backgroundColor: Colors.grey,
          appBar: AppBar(
            title: Text('Mesocycle View'),
            centerTitle: true,
            backgroundColor: Colors.amber,
          ),
          // #region Grid
          body: Center(
            child: Container(
              //margin: EdgeInsets.fromLTRB(100.0, 10.0, 10.0, 10.0),
              child: GridView(
                children: [
                  
                  Container(
                      child: DropdownButton(
                    hint: _gluteMode == null
                        ? Center(child: Text('Mode'))
                        : Center(
                            child: Text(
                              _gluteMode,
                              style: TextStyle(
                                  color: Colors.black, fontSize: _fontSize),
                            ),
                          ),
                    isExpanded: true,
                    iconSize: 30.0,
                    style: TextStyle(color: Colors.black, fontSize: _fontSize),
                    items: ['Max', 'Min', 'Maintain', 'Off'].map(
                      (val) {
                        return DropdownMenuItem&lt;String&gt;(
                          value: val,
                          child: Text(val),
                        );
                      },
                    ).toList(),
                    onChanged: (val) {
                      setState(
                        () {
                          _gluteMode = val.toString();
                          Meso1.set_Mode('glutes', _gluteMode);
                          Meso1.generateGluteVolume();
                        },
                      );
                    },
                  )),
                  Container(
                      child: DropdownButton(
                    hint: _gluteFreq == null
                        ? Center(child: Text('Freq.'))
                        : Center(
                            child: Text(
                              _gluteFreq,
                              style: TextStyle(
                                color: Colors.black,
                                fontSize: _fontSize,
                              ),
                            ),
                          ),
                    isExpanded: true,
                    iconSize: 30.0,
                    style: TextStyle(color: Colors.black, fontSize: _fontSize),
                    items: ['2', '3', '4'].map(
                      (val) {
                        return DropdownMenuItem&lt;String&gt;(
                          value: val,
                          child: Text(val),
                        );
                      },
                    ).toList(),
                    onChanged: (val) {
                      setState(
                        () {
                          _gluteFreq = val;
                          Meso1.set_Freq('glutes', _gluteFreq);
                          Meso1.generateGluteVolume();
                        },
                      );
                    },
                  )),
  ... etc
  </code></pre>
  <p>E/flutter (11519): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type 'double' is not a subtype of type 'int' of 'value'</p>
  <p>E/flutter (11519): #0      List.add (dart:core-patch/growable_array.dart)</p>
  <p>E/flutter (11519): #1      Mesocycle.generateGluteVolume</p>
  <p>E/flutter (11519): #2      _MesocycleViewState.build..</p>
  <p>E/flutter (11519): #3      State.setState</p>
  <p>E/flutter (11519): #4      _MesocycleViewState.build.</p>
  <p>E/flutter (11519): #5      _DropdownButtonState._handleTap.</p>
  <p>E/flutter (11519): #6      _rootRunUnary (dart:async/zone.dart:1434:47)</p>
  <p>E/flutter (11519): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)</p>
  <p>E/flutter (11519): asynchronous suspension</p>