在Dart中的urlencoding [英] urlencoding in Dart
问题描述
有一个函数做Dart中的urlencoding吗?我使用XMLHttpRequest对象做一个AJAX调用,我需要url编码。
Is there a function to do urlencoding in Dart? I am doing a AJAX call using XMLHttpRequest object and I need the url to be url encoded.
我在dartlang.org上搜索,但是没有打开任何结果。
I did a search on dartlang.org, but it didn't turn up any results.
推荐答案
更新:现在支持 Dart Uri类
Dart的URI代码放在一个名为 dart:uri (因此可以在 dart:html
和 dart:io
)。我看起来它目前不包括 urlencode
函数,所以你现在最好的选择可能是使用 this Dart实现JavaScript的 encodeUriComponent
。
Dart's URI code is placed in a separate library called dart:uri (so it can be shared between dart:html
and dart:io
). I looks like it currently does not include a urlencode
function so your best alternative for now is probably to use this Dart implementation of JavaScript's encodeUriComponent
.
这篇关于在Dart中的urlencoding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!