Skip to content

Commit

Permalink
refactor: filter toJson
Browse files Browse the repository at this point in the history
  • Loading branch information
ethicnology committed Sep 1, 2023
1 parent 689db80 commit 44edfc4
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions lib/src/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,15 @@ class Filter {
/// Serialize a filter in JSON
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (ids != null) {
data['ids'] = ids;
}
if (authors != null) {
data['authors'] = authors;
}
if (kinds != null) {
data['kinds'] = kinds;
}
if (e != null) {
data['#e'] = e;
}
if (a != null) {
data['#a'] = a;
}
if (p != null) {
data['#p'] = p;
}
if (since != null) {
data['since'] = since;
}
if (until != null) {
data['until'] = until;
}
if (limit != null) {
data['limit'] = limit;
}
if (ids != null) data['ids'] = ids;
if (authors != null) data['authors'] = authors;
if (kinds != null) data['kinds'] = kinds;
if (e != null) data['#e'] = e;
if (a != null) data['#a'] = a;
if (p != null) data['#p'] = p;
if (since != null) data['since'] = since;
if (until != null) data['until'] = until;
if (limit != null) data['limit'] = limit;
return data;
}
}

0 comments on commit 44edfc4

Please sign in to comment.