splitQueryString method
Map<String, String> splitQueryString(Returns the query
split into a map according to the rules specified for FORM post in the HTML 4.01 specification section 17.13.4. Each key and value in the returned map has been decoded. If the query
is the empty string an empty map is returned.
Keys in the query string that have no value are mapped to the empty string.
Each query component will be decoded using encoding
. The default encoding is UTF-8.
Source
static Map<String, String> splitQueryString(String query, {Encoding encoding: UTF8}) { return query.split("&").fold({}, (map, element) { int index = element.indexOf("="); if (index == -1) { if (element != "") { map[decodeQueryComponent(element, encoding: encoding)] = ""; } } else if (index != 0) { var key = element.substring(0, index); var value = element.substring(index + 1); map[decodeQueryComponent(key, encoding: encoding)] = decodeQueryComponent(value, encoding: encoding); } return map; }); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/Uri/splitQueryString.html