mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-10 21:13:57 +08:00
analysis: Use curly_braces_in_flow_control_structures
One step closer to using dart:pedantic
This commit is contained in:
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user