analysis: Use curly_braces_in_flow_control_structures

One step closer to using dart:pedantic
This commit is contained in:
Vishesh Handa
2020-01-26 03:01:03 +01:00
parent 44781733f8
commit 0da1a0783c
2 changed files with 12 additions and 7 deletions

View File

@ -99,6 +99,7 @@ linter:
- prefer_void_to_null - prefer_void_to_null
# - recursive_getters # https://github.com/dart-lang/linter/issues/452 # - recursive_getters # https://github.com/dart-lang/linter/issues/452
- slash_for_doc_comments - slash_for_doc_comments
- curly_braces_in_flow_control_structures
# - sort_constructors_first # - sort_constructors_first
# - sort_unnamed_constructors_first # - sort_unnamed_constructors_first
# - type_annotate_public_apis # subset of always_specify_types # - type_annotate_public_apis # subset of always_specify_types

View File

@ -20,24 +20,28 @@ class NoteSerializer implements NoteSerializerInterface {
@override @override
void encode(Note note, NoteData data) { void encode(Note note, NoteData data) {
if (note.created != null) if (note.created != null) {
data.props[settings.createdKey] = toIso8601WithTimezone(note.created); data.props[settings.createdKey] = toIso8601WithTimezone(note.created);
else } else {
data.props.remove(settings.createdKey); data.props.remove(settings.createdKey);
}
if (note.modified != null) if (note.modified != null) {
data.props[settings.modifiedKey] = toIso8601WithTimezone(note.modified); data.props[settings.modifiedKey] = toIso8601WithTimezone(note.modified);
else } else {
data.props.remove(settings.modifiedKey); data.props.remove(settings.modifiedKey);
}
if (note.title != null) { if (note.title != null) {
var title = note.title.trim(); var title = note.title.trim();
if (title.isNotEmpty) if (title.isNotEmpty) {
data.props[settings.titleKey] = note.title; data.props[settings.titleKey] = note.title;
else } else {
data.props.remove(settings.titleKey); data.props.remove(settings.titleKey);
} else }
} else {
data.props.remove(settings.titleKey); data.props.remove(settings.titleKey);
}
data.body = note.body; data.body = note.body;
} }