toMap method
根据连接字符拼接的字符串转换成map
示例:"siteId=2&positionValue=71"
firstSplit
一级分隔符
secondSplit
二级分隔符
isDecode
value是否需要Uri.decodeComponent解码
Implementation
Map<String, dynamic> toMap(String firstSplit,
{String secondSplit = "", bool? isDecode}) {
var map = LinkedHashMap<String, dynamic>();
if (this.isNotEmptyString && firstSplit.isNotEmptyString) {
var list = this.split(firstSplit);
list.forEach((element) {
if (element.isNotEmptyString) {
var entry = element.toMapEntry(secondSplit, isDecode ?? false);
if (entry != null) {
map[entry.key] = entry.value;
}
}
});
}
return map;
}