【发布时间】:2013-12-27 17:17:16
【问题描述】:
我有一种情况需要将Map 转换为查询字符串(在第一个? 之后)。例如,如果我有以下地图:
Map json = {
"email": eml,
"password": passwd
};
还有一个基本 URL:
String baseURL = "http://localhost:8080/myapp";
然后我需要将 json Map 转换为基本 URL 的查询字符串的东西:
String fullURL = parameterizeURL(baseURL, json);
// Prints: http://localhost:8080/myapp?email=blah&password=meh
// (if "blah" was entered as the email, and "meh" was entered as the password)
print(fullURL);
我在 Git 上找到了this query String-to-map library,但我需要这个的逆!如果也能在其中获得 URL 编码,那就太好了。
我很高兴自己制作一些东西,但对 Dart 来说如此陌生,我想知道 pub/Github/etherspehere 上是否有任何东西已经这样做了。
【问题讨论】:
标签: url map type-conversion query-string dart