I have an issue where i am running this code and getting all different combinations of the number without repeating.

It is put in a for loop where I have a list of numbers.

If the list is only of just 1 number, it seems to be alright. However when I have multiple numbers in the list, Android studio loses connection to my device.

Is it because my app is doing too much? If not how do I fix it?

List<String> rollNumberGenerator(String num) {
    List numberToBeRolled = num.split('');

    List<String> generatedRollList = [];

    String zero = numberToBeRolled[0];
    String one = numberToBeRolled[1];
    String two = numberToBeRolled[2];
    String three = numberToBeRolled[3];

    String rollNumber1 = '$zero$one$two$three';
    String rollNumber2 = '$zero$one$three$two';
    String rollNumber3 = '$zero$three$one$two';
    String rollNumber4 = '$three$zero$one$two';
    String rollNumber5 = '$three$zero$two$one';
    String rollNumber6 = '$zero$three$two$one';
    String rollNumber7 = '$zero$two$three$one';
    String rollNumber8 = '$zero$two$one$three';
    String rollNumber9 = '$two$zero$one$three';
    String rollNumber10 = '$two$zero$three$one';
    String rollNumber11 = '$two$three$zero$one';
    String rollNumber12 = '$three$two$zero$one';
    String rollNumber13 = '$three$two$one$zero';
    String rollNumber14 = '$two$three$one$zero';
    String rollNumber15 = '$two$one$three$zero';
    String rollNumber16 = '$two$one$zero$three';
    String rollNumber17 = '$one$two$zero$three';
    String rollNumber18 = '$one$two$three$zero';
    String rollNumber19 = '$one$three$two$zero';
    String rollNumber20 = '$three$one$two$zero';
    String rollNumber21 = '$three$one$zero$two';
    String rollNumber22 = '$one$three$zero$two';
    String rollNumber23 = '$one$zero$three$two';
    String rollNumber24 = '$one$zero$two$three';

    generatedRollList.add(rollNumber1);
    generatedRollList.add(rollNumber2);
    generatedRollList.add(rollNumber3);
    generatedRollList.add(rollNumber4);
    generatedRollList.add(rollNumber5);
    generatedRollList.add(rollNumber6);
    generatedRollList.add(rollNumber7);
    generatedRollList.add(rollNumber8);
    generatedRollList.add(rollNumber9);
    generatedRollList.add(rollNumber10);
    generatedRollList.add(rollNumber11);
    generatedRollList.add(rollNumber12);
    generatedRollList.add(rollNumber13);
    generatedRollList.add(rollNumber14);
    generatedRollList.add(rollNumber15);
    generatedRollList.add(rollNumber16);
    generatedRollList.add(rollNumber17);
    generatedRollList.add(rollNumber18);
    generatedRollList.add(rollNumber19);
    generatedRollList.add(rollNumber20);
    generatedRollList.add(rollNumber21);
    generatedRollList.add(rollNumber22);
    generatedRollList.add(rollNumber23);
    generatedRollList.add(rollNumber24);

    List<String> validGeneratedRollList = [];

    for (var numbers in generatedRollList) {
      bool present = false;
      present = validGeneratedRollList.contains(numbers);
      if (present == false) {
        validGeneratedRollList.add(numbers);
      }
    }
    return validGeneratedRollList;
  }

Thanks in advance for anyone that can help!