getNewWebUrlByAddParams static method
为当前的 web url 添加其他额外参数(参数的值如果是对象,则会自动 jsonEncode)
PS1: 获取 url host: String getUrlHostFromWebUrl(String webUrl); PS2: 获取 all params: Map<String, dynamic>? getAllParamsFromWebUrl(String webUrl, {required bool paramToObjectIfOK})
Implementation
static String getNewWebUrlByAddParams(
String currentWebUrl,
Map<String, dynamic> addParams,
) {
String? addParamsString = encodeParam(addParams);
if (addParamsString == null || addParamsString.isEmpty) {
return currentWebUrl;
}
if (currentWebUrl.contains('?')) {
return "$currentWebUrl&$addParamsString";
} else {
return "$currentWebUrl?$addParamsString";
}
}