Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is `dart:uri` now?

Tags:

uri

dart

I want to call decodeUrl(...) and I was doing it as:

import "dart:uri";

main() {
    decodeUrl("str");
}

But now with the latest Dart-SDK, it reports:

Do not know how to load 'dart:uri'
import 'dart:uri';
^

Seems it has been removed from the SDK. I searched a lot but still don't know where is it now. How to use the decodeUrl(...) with latest SDK now?

like image 937
Freewind Avatar asked Jul 14 '13 04:07

Freewind


People also ask

What is Uri in Dart?

The Uri class supports functions to encode and decode strings for use in URIs (which you might know as URLs). These functions control characters that are unique for URIs, such as & and =. This class also parses and exposes the components of a URI—host, port, scheme, and so on.

What is Uri parse in flutter?

parse method Null safetyCreates a new Uri object by parsing a URI string. If start and end are provided, they must specify a valid substring of uri , and only the substring from start to end is parsed as a URI. If the uri string is not valid as a URI or URI reference, a FormatException is thrown.


1 Answers

According to this post to the Dart announcement list, dart:uri has been replaced with the core Uri class.

Your code translates to:

main() {
  decodeUrl("str");
}

Though it might be more instructive to write print(Uri.decodeFull("str%20here"));.

like image 93
jrockway Avatar answered Sep 27 '22 16:09

jrockway