From 0da1a0783c2708b118dfcfaac97e48d6f6bdf73d Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Sun, 26 Jan 2020 03:01:03 +0100 Subject: [PATCH] analysis: Use curly_braces_in_flow_control_structures One step closer to using dart:pedantic --- analysis_options.yaml | 1 + lib/core/note_serializer.dart | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 8a7b6890..72945edb 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -99,6 +99,7 @@ linter: - prefer_void_to_null # - recursive_getters # https://github.com/dart-lang/linter/issues/452 - slash_for_doc_comments + - curly_braces_in_flow_control_structures # - sort_constructors_first # - sort_unnamed_constructors_first # - type_annotate_public_apis # subset of always_specify_types diff --git a/lib/core/note_serializer.dart b/lib/core/note_serializer.dart index 476e7752..28747f50 100644 --- a/lib/core/note_serializer.dart +++ b/lib/core/note_serializer.dart @@ -20,24 +20,28 @@ class NoteSerializer implements NoteSerializerInterface { @override void encode(Note note, NoteData data) { - if (note.created != null) + if (note.created != null) { data.props[settings.createdKey] = toIso8601WithTimezone(note.created); - else + } else { data.props.remove(settings.createdKey); + } - if (note.modified != null) + if (note.modified != null) { data.props[settings.modifiedKey] = toIso8601WithTimezone(note.modified); - else + } else { data.props.remove(settings.modifiedKey); + } if (note.title != null) { var title = note.title.trim(); - if (title.isNotEmpty) + if (title.isNotEmpty) { data.props[settings.titleKey] = note.title; - else + } else { data.props.remove(settings.titleKey); - } else + } + } else { data.props.remove(settings.titleKey); + } data.body = note.body; }