@@ -9,11 +9,11 @@ import 'package:saber/pages/editor/editor.dart';
9
9
class SortNotes {
10
10
SortNotes ._();
11
11
12
- static final Map < String , void Function (List <String >, bool )> _sortFunctions = {
13
- t.home.sortNames.alphabetical : _sortNotesAlpha,
14
- t.home.sortNames.lastModified : _sortNotesLastModified,
15
- t.home.sortNames.sizeOnDisk : _sortNotesSize,
16
- } ;
12
+ static final List < void Function (List <String >, bool )> _sortFunctions = [
13
+ _sortNotesAlpha,
14
+ _sortNotesLastModified,
15
+ _sortNotesSize,
16
+ ] ;
17
17
static final PlainPref <int > _sortFunctionIdx = Prefs .sortFunctionIdx;
18
18
static final PlainPref <bool > _isIncreasingOrder = Prefs .isSortIncreasing;
19
19
@@ -43,8 +43,7 @@ class SortNotes {
43
43
44
44
static void sortNotes (List <String > filePaths, {bool forced = false }) {
45
45
if (_isNeeded || forced) {
46
- _sortFunctions[_sortFunctions.keys.elementAt (sortFunctionIdx)]!
47
- .call (filePaths, isIncreasingOrder);
46
+ _sortFunctions[sortFunctionIdx].call (filePaths, isIncreasingOrder);
48
47
_isNeeded = false ;
49
48
}
50
49
}
@@ -144,7 +143,12 @@ class _SortButtonDialog extends StatefulWidget {
144
143
class _SortButtonDialogState extends State <_SortButtonDialog > {
145
144
@override
146
145
Widget build (BuildContext context) {
147
- final List <String > sortNames = SortNotes ._sortFunctions.keys.toList ();
146
+ // Needs to match the order of _sortFunctions
147
+ final List <String > sortNames = [
148
+ t.home.sortNames.alphabetical,
149
+ t.home.sortNames.lastModified,
150
+ t.home.sortNames.sizeOnDisk,
151
+ ];
148
152
149
153
return Align (
150
154
alignment: Alignment .topRight,
0 commit comments