Skip to content

Commit

Permalink
rewrite compare loop
Browse files Browse the repository at this point in the history
  • Loading branch information
atn832 committed Nov 6, 2024
1 parent e177485 commit 57311c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/src/mock_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ class MockQuery<T extends Object?> extends FakeQueryWithParent<T> {
}

sortedList.sort((d1, d2) {
var compare = doCompare(fields.first, directions.first, d1, d2);
var index = 1;
while (compare == 0 && index < fields.length) {
compare = doCompare(fields[index], directions[index], d1, d2);
index++;
for (var i = 0; i < fields.length; i++) {
final compare = doCompare(fields[i], directions[i], d1, d2);
if (compare != 0) {
return compare;
}
}
return compare;
return 0;
});

return sortedList;
Expand Down

0 comments on commit 57311c7

Please sign in to comment.