Fix bug when you have less than 10 notes

Fixes #73
This commit is contained in:
Vishesh Handa
2020-03-02 17:37:47 +01:00
parent de2553c31f
commit c65ec96da2

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
@ -61,7 +62,7 @@ class NotesCache {
assert(files.every((n) => n.loadState == NoteLoadState.Loaded));
files.sort(sortingMode.sortingFunction());
files = files.sublist(0, 10);
files = files.sublist(0, min(10, files.length));
var fileList = files.map((f) => f.filePath).toList();
return saveToDisk(fileList);