Skip to content

Commit 60b19b1

Browse files
committed
Added result sorting
1 parent 893790b commit 60b19b1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

example/lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ class _MyAppState extends State<MyApp> {
4646
Future<void> _updateHighlights(String code) async {
4747
print('Updating highlights $code');
4848
_code = code;
49-
_highlightsPlugin.getHighlights(
49+
_highlightsPlugin
50+
.getHighlights(
5051
_code ?? '',
5152
_language,
5253
_theme,
5354
_emphasis,
54-
).then((value) {
55+
)
56+
.then((value) {
5557
print('Flutter Highlights $value');
5658
setState(() {
57-
// TODO Sort by position
59+
value.sort((a, b) => a.location.start.compareTo(b.location.start));
5860
_highlights = value.map((highlight) => highlight.toString()).toList();
5961
});
6062
});

0 commit comments

Comments
 (0)