File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ class SortingProvider extends ChangeNotifier {
99 final List <int > _indexArr;
1010 double _animationSpeed = 0 ;
1111 bool _stopSort = true ;
12- int _swapI = 0 ;
13- int _swapJ = 0 ;
12+ int _swapI = - 1 ;
13+ int _swapJ = - 1 ;
1414
1515 SortingType _selectedSortingType = SortingType .BUBBLE_SORT ;
1616
@@ -56,8 +56,8 @@ class SortingProvider extends ChangeNotifier {
5656 void reset () {
5757 /// Stop sorting
5858 _stopSort = true ;
59- _swapI = 0 ;
60- _swapJ = 0 ;
59+ _swapI = - 1 ;
60+ _swapJ = - 1 ;
6161 notifyListeners ();
6262
6363 /// Reset the main array which is being sorted
@@ -135,8 +135,8 @@ class SortingProvider extends ChangeNotifier {
135135 await _delay;
136136 }
137137
138- _swapI = 0 ;
139- _swapJ = 0 ;
138+ _swapI = - 1 ;
139+ _swapJ = - 1 ;
140140 notifyListeners ();
141141 }
142142
@@ -174,8 +174,8 @@ class SortingProvider extends ChangeNotifier {
174174 await _delay;
175175 }
176176
177- _swapI = 0 ;
178- _swapJ = 0 ;
177+ _swapI = - 1 ;
178+ _swapJ = - 1 ;
179179
180180 notifyListeners ();
181181 }
@@ -214,8 +214,8 @@ class SortingProvider extends ChangeNotifier {
214214 await _swap (i, smallestIndex);
215215 }
216216
217- _swapI = 0 ;
218- _swapJ = 0 ;
217+ _swapI = - 1 ;
218+ _swapJ = - 1 ;
219219 notifyListeners ();
220220 }
221221
@@ -233,8 +233,8 @@ class SortingProvider extends ChangeNotifier {
233233 await _merge (start, mid, end);
234234 }
235235
236- _swapI = 0 ;
237- _swapJ = 0 ;
236+ _swapI = - 1 ;
237+ _swapJ = - 1 ;
238238 notifyListeners ();
239239 }
240240
@@ -317,8 +317,8 @@ class SortingProvider extends ChangeNotifier {
317317 notifyListeners ();
318318 }
319319
320- _swapI = 0 ;
321- _swapJ = 0 ;
320+ _swapI = - 1 ;
321+ _swapJ = - 1 ;
322322 }
323323
324324 Future <void > _quickSort (int start, int end) async {
@@ -351,8 +351,8 @@ class SortingProvider extends ChangeNotifier {
351351
352352 await _swap (pIndex, end);
353353
354- _swapI = 0 ;
355- _swapJ = 0 ;
354+ _swapI = - 1 ;
355+ _swapJ = - 1 ;
356356 notifyListeners ();
357357
358358 return pIndex;
You can’t perform that action at this time.
0 commit comments