diff --git a/lib/core/note.dart b/lib/core/note.dart index 7fae18ac..56907cb6 100644 --- a/lib/core/note.dart +++ b/lib/core/note.dart @@ -53,9 +53,7 @@ enum NoteType { } class NoteFileFormatInfo { - static List allowedExtensions() { - return ['.md', '.org', '.txt']; - } + static List allowedExtensions = ['.md', '.org', '.txt']; static String defaultExtension(NoteFileFormat format) { switch (format) { @@ -72,11 +70,13 @@ class NoteFileFormatInfo { static bool isAllowedFileName(String filePath) { var noteFilePath = filePath.toLowerCase(); - var isMarkdownFile = noteFilePath.endsWith('.md'); - var isTxtFile = noteFilePath.endsWith('.txt'); - var isOrgFile = noteFilePath.endsWith('.org'); + for (var ext in allowedExtensions) { + if (noteFilePath.endsWith(ext)) { + return true; + } + } - return isMarkdownFile || isTxtFile || isOrgFile; + return false; } }