removeLevel method

void removeLevel(
  1. int level
)

Implementation

void removeLevel(int level){
  if(levelInfo.length == 1){
    levelInfo = [
      Levels(
        name: 'Level1',
      )
    ];
    selectedLevel = 0;
  }
  else{
    levelInfo.removeAt(level);
  }

  if(selectedLevel >= levelInfo.length){
    selectedLevel = 0;
  }
  update();
}