diff --git a/analysis_options.yaml b/analysis_options.yaml index 33330570..d83ed179 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -81,7 +81,7 @@ linter: - package_prefixed_library_names # - parameter_assignments # we do this commonly - prefer_adjacent_string_concatenation - # - prefer_collection_literals + - prefer_collection_literals # - prefer_conditional_assignment # not yet tested # - prefer_const_constructors # - prefer_constructors_over_static_methods # not yet tested diff --git a/lib/apis/github.dart b/lib/apis/github.dart index 5308143a..21abd0a5 100644 --- a/lib/apis/github.dart +++ b/lib/apis/github.dart @@ -93,7 +93,7 @@ class GitHub implements GitHost { } List list = jsonDecode(response.body); - var repos = List(); + var repos = []; list.forEach((dynamic d) { var map = Map.from(d); var repo = _repoFromJson(map); diff --git a/lib/apis/gitlab.dart b/lib/apis/gitlab.dart index 19675d52..b29bcaae 100644 --- a/lib/apis/gitlab.dart +++ b/lib/apis/gitlab.dart @@ -82,7 +82,7 @@ class GitLab implements GitHost { } List list = jsonDecode(response.body); - var repos = List(); + var repos = []; list.forEach((dynamic d) { var map = Map.from(d); var repo = _repoFromJson(map); diff --git a/lib/note.dart b/lib/note.dart index 99100b4c..22d2ca1f 100644 --- a/lib/note.dart +++ b/lib/note.dart @@ -5,14 +5,14 @@ class Note implements Comparable { DateTime created; String body; - Map extraProperties = Map(); + Map extraProperties = {}; Note({this.created, this.body, this.filePath, this.extraProperties}) { if (created == null) { created = DateTime(0, 0, 0, 0, 0, 0, 0, 0); } if (extraProperties == null) { - extraProperties = Map(); + extraProperties = {}; } } diff --git a/lib/storage/file_storage.dart b/lib/storage/file_storage.dart index 15a6a17c..6553dcfb 100644 --- a/lib/storage/file_storage.dart +++ b/lib/storage/file_storage.dart @@ -28,7 +28,7 @@ class FileStorage implements NoteRepository { Future> listNotes() async { final dir = Directory(baseDirectory); - var notes = List(); + var notes = []; var lister = dir.list(recursive: false); await for (var fileEntity in lister) { Note note = await _loadNote(fileEntity); diff --git a/lib/storage/serializers.dart b/lib/storage/serializers.dart index 128650c3..ca413c0e 100644 --- a/lib/storage/serializers.dart +++ b/lib/storage/serializers.dart @@ -28,7 +28,7 @@ class MarkdownYAMLSerializer implements NoteSerializer { var parts = str.split("---\n"); var yamlMap = loadYaml(parts[1]); - var map = Map(); + var map = {}; yamlMap.forEach((key, value) { map[key] = value; }); @@ -37,7 +37,7 @@ class MarkdownYAMLSerializer implements NoteSerializer { return Note.fromJson(map); } - var map = Map(); + var map = {}; map['body'] = str; return Note.fromJson(map); }