The URL URI is stupid, Dart tells you how to use

If we have to access a website, you need to know the address of this website, the address of the website is generally called URL, and his full name is Uniform Resource Locator. So what is the URI?

The entire process of the URI is Uniform Resource Identifier, namely a unified resource icon.

The URI is used to mark the resource, and the URL is tagged on the network, so the URL is a subset of the URI.

After understanding the relationship between the URI and the URL, let’s take a look at the support of the DART language on the URI.

A specialty class named URI is created in DART:

The URI is an abstract class that he defines some basic operations to the URI. It has three implementations, named _uri, _datauri and _simpleuri.

Next, let’s take a look at the URI in Dart.

Why do you want to Encode URI?

In general, there may be some special characters in the URI, such as space or Chinese, and so on. These characters may not be known by the other party in the transfer. So we need to encode the URI.

But for some special but meaningful characters in the URI, such as: /,:, &, #, which are not essential.

So we need a method of unifying encoding and decoding.

In Dart, this method is called Encodefull and Decodefull:

If you want to encode all characters, including those meaningful characters: /,:, &, #, then EncodeComponent and DecodeComponent:

The URI is composed of Scheme, Host, Path, and Fragment. We can decompose the URI through these properties in the URI:

So how do you construct the URI? We can use the constructor of the URI:

This article has been included in www.flydean.com

The most popular interpretation, the most profound dry goods, the clearest tutorial, many tips you don’t know, etc.!

"Those things", understand the technology, know you! "