@@ -138,8 +138,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
138138
139139 await cancelSearching ();
140140
141- _cancelableSearch =
142- CancelableOperation .fromFuture (_clearTheGridFun (clearAnyway: clearAnyway, keepWall: keepWall));
141+ _cancelableSearch = CancelableOperation .fromFuture (_clearTheGridFun (clearAnyway: clearAnyway, keepWall: keepWall));
143142
144143 try {
145144 await _cancelableSearch? .value;
@@ -174,9 +173,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
174173 /// when you try to draw on the right border if you make the arrow closly to the border it will draw the wall in the left side (the next index)
175174 /// those two lines to prevent that
176175 final calcIndex = (event.localPosition.dx / _gridSquareSize).floor ();
177- if (calcIndex != 0 &&
178- calcIndex % state.columnCrossAxisCount == 0 &&
179- index % state.columnCrossAxisCount == 0 ) {
176+ if (calcIndex != 0 && calcIndex % state.columnCrossAxisCount == 0 && index % state.columnCrossAxisCount == 0 ) {
180177 index-- ;
181178 }
182179
@@ -300,8 +297,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
300297 }
301298
302299 /// for marking the current grid as visited
303- if (gridData[currentIndex] != GridStatus .startPoint &&
304- gridData[currentIndex] != GridStatus .targetPoint) {
300+ if (gridData[currentIndex] != GridStatus .startPoint && gridData[currentIndex] != GridStatus .targetPoint) {
305301 gridData[currentIndex] = GridStatus .searcher;
306302 state = state.copyWith (gridData: List <GridStatus >.from (gridData));
307303 await Future .delayed (drawSearcherDuration);
@@ -384,8 +380,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
384380 previous[neighborIndex] = currentIndex;
385381 pq.add (neighborIndex);
386382
387- if (gridData[neighborIndex] != GridStatus .startPoint &&
388- gridData[neighborIndex] != GridStatus .targetPoint) {
383+ if (gridData[neighborIndex] != GridStatus .startPoint && gridData[neighborIndex] != GridStatus .targetPoint) {
389384 gridData[neighborIndex] = GridStatus .searcher;
390385 state = state.copyWith (gridData: List <GridStatus >.from (gridData));
391386 await Future .delayed (drawSearcherDuration);
@@ -397,17 +392,14 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
397392 _isSearched = true ;
398393 }
399394
400- bool _isValidNeighbor (
401- int currentIndex, int neighborIndex, int direction, int cross, List <GridStatus > gridData) {
395+ bool _isValidNeighbor (int currentIndex, int neighborIndex, int direction, int cross, List <GridStatus > gridData) {
402396 final isFirstLeftInRowIndex = neighborIndex % cross == 0 ;
403397 final isEndRightInRowIndex = (neighborIndex + 1 ) % cross == 0 ;
404398
405399 if (direction == 1 && isFirstLeftInRowIndex) return false ;
406400 if (direction == - 1 && isEndRightInRowIndex) return false ;
407401
408- return neighborIndex >= 0 &&
409- neighborIndex < gridData.length &&
410- gridData[neighborIndex] != GridStatus .wall;
402+ return neighborIndex >= 0 && neighborIndex < gridData.length && gridData[neighborIndex] != GridStatus .wall;
411403 }
412404
413405 Future <void > _tracePath (List <int ?> previous, int currentIndex) async {
@@ -505,8 +497,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
505497 pq.add (neighborIndex);
506498 }
507499
508- if (gridData[neighborIndex] != GridStatus .startPoint &&
509- gridData[neighborIndex] != GridStatus .targetPoint) {
500+ if (gridData[neighborIndex] != GridStatus .startPoint && gridData[neighborIndex] != GridStatus .targetPoint) {
510501 gridData[neighborIndex] = GridStatus .searcher;
511502 state = state.copyWith (gridData: List <GridStatus >.from (gridData));
512503 await Future .delayed (drawSearcherDuration);
@@ -614,8 +605,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
614605 final newRow = row + direction.rowDelta * 2 ;
615606 final newCol = col + direction.colDelta * 2 ;
616607
617- if (_isValidCell (newRow, newCol) &&
618- gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus .empty) {
608+ if (_isValidCell (newRow, newCol) && gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus .empty) {
619609 final betweenRow = row + direction.rowDelta;
620610 final betweenCol = col + direction.colDelta;
621611
0 commit comments