title: Flutter/Dart: How to return a List from a method and set it to another List
body: <p>Problem: How to retrieve from a list and append to a new list saved locally, to be used by methods in the same class.</p>
  
  <p>I would like to store whats in exerciseList and put it into the local variable 
  List CustomExercises; When I return custom exercises from getAllExercisesAsStrings() it doesn't update.</p>
  
  <pre><code>class GenerateCustom extends ExerciseListState {
    int rnd;
  
    GenerateCustom({this.difficulty});
    final int difficulty;
    String workout;
    String ex1;
    String ex2;
    String ex3;
    String ex4;
    String ex5;
  
    List customExercises = [];
  
    //get list of custom workouts
    List getAllExercisesAsStrings(customExercises) {
      var n;
      for (n = 0; n &lt; exerciseList.length; n++) {
  //      print(exerciseList[n].title);
        customExercises.add(exerciseList[n].title);
      }
      return customExercises;
    }
  </code></pre>
  
  <p>For context the getCustomType() gets a random exercise from the list to be displayed.</p>
  
  <pre><code>String getCustomType() {
      var random = Random();
      var i = random.nextInt(customExercises.length);
      print(customExercises[i]);
      return customExercises[i];
    }
  
    String cExerciseOne() {
      if (difficulty == 1) {
        workout =
            ('1: ' + getCustomType() + ' ' + getRepsEasy() + 'x' + getSetsEasy());
      } else if (difficulty == 2) {
        workout = ('1: ' +
            getCustomType() +
            ' ' +
            getRepsMedium() +
            'x' +
            getSetsMedium());
      } else {
        workout =
            ('1: ' + getCustomType() + ' ' + getRepsHard() + 'x' + getSetsHard());
      }
      return workout;
    }
  </code></pre>
  
  <hr>
  
  <p>When I print to console <code>exerciseList[n].title</code> it returns the list with the exercises e.g. <code>['exercise1','Bicep Curl', 'Pull Up', ]</code> etc. These exercises have already been retrieved in the parent class and I would like to store them in the new list. Any guidance would be great and if you think more context is needed let me know.</p>