Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

urlencoding in Dart

Tags:

urlencode

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.

like image 730
Sudar Avatar asked Apr 20 '12 13:04

Sudar


People also ask

How do you encode a URL in dart?

In this case, you only need to do: parsedData = Uri. encodeComponent(STR_DATA); to get the same result as the Python code.

How do I encode in flutter?

To encode or decode Base64 in Dart, you can make use of the dart:convert library: import 'dart:convert'; For base64 decoding, use one of these 2 methods: String base64.


1 Answers

var uri = 'http://example.org/api?foo=some message'; var encoded = Uri.encodeFull(uri); assert(encoded == 'http://example.org/api?foo=some%20message');  var decoded = Uri.decodeFull(encoded); assert(uri == decoded); 

http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-uri

like image 98
gines capote Avatar answered Oct 13 '22 12:10

gines capote