Search code examples
urlencodedart

urlencoding in Dart


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.

I did a search on dartlang.org, but it didn't turn up any results.


Solution

  • Update: There is now support for encode/decode URI in the Dart Uri class

    Dart's URI code is placed in a separate library called dart:uri (so it can be shared between both dart:html and dart:io). It 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.