Tag Archives: URLEncoding

Using YQL in Dart

I was exploring Dart, and wanted to create a small project using it to compare it with JavaScript. I was searching for ideas and then I thought of using YQL in Dart, to see how easy or difficult it is.

After poking around a bit, I found that Dart supports making Rest calls using XMLHttpRequest object, similar to JavaScript. I quickly tried to make a YQL call using that object.

The following is the bulk of the code. It is exactly how you do it in plain JavaScript.


The only place I found a problem, was that Dart doesn’t have a URLEncoder yet. You have to emulate the URLEncoding done in JavaScript. I hope Dart gets its own URLEncoder soon.

Full source code

I have uploaded the full source code to github and added a couple of other examples as well. Check it out.

Posted in JavaScript/jQuery | Tagged , , | 10 Comments

URLEncoding in Dart

I was trying to use YQL from Dart and found that there is no way you can do URLEncoding using Dart.

I searched the dart:html, dart:uri and dart:io packages and found that none of them have the method to do URLEncoding.

I then posted about it in stackoverflow and then later found that, right now the only way to do URLEncoding is to emulate the encodeURL() function of JavaScript. Someone from Google has already done it. I just copied the file and placed inside my Dart project and then used the following line in my dart file.


Although it works right now, I would really like to see this as part of the dart:uri package. Let’s see if someone from the Dart team is listening to this.


Posted in JavaScript/jQuery | Tagged , , | 5 Comments