Skip to content

Commit

Permalink
Refactor handling of null request values as per PR comments. See: htt…
Browse files Browse the repository at this point in the history
  • Loading branch information
bobjackman committed Apr 14, 2017
1 parent 1786d37 commit 3fffb44
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ Map/*<K, V>*/ updateMap/*<K, V>*/(
/// mapToQuery({"foo": "bar", "baz": "bang"});
/// //=> "foo=bar&baz=bang"
String mapToQuery(Map<String, String> map, {Encoding encoding}) {
map.keys
.where((k) => (map[k] == null)).toList() // -- keys for null elements
.forEach(map.remove);
var nullKeys = map.keys.where((k) => (map[k] == null)).toList();
nullKeys.forEach(map.remove); // -- remove elements with null values

var pairs = <List<String>>[];
map.forEach((key, value) =>
Expand Down

0 comments on commit 3fffb44

Please sign in to comment.