top of page

[Flutter/dart]Open a URL that requires encoding


Problem

Previously, I wrote an article that it is necessary to encode to open a URL containing Japanese.

However, re-encoding an already encoded URL will result in a different URL.

In other words, before processing to open the URL,

  • Does the URL require encoding?

  • Is it already encoded?

will have to be judged. This is a rather complicated process.


Situation

As a situation where the above problem occurs, there is a case opening the URL registered by the user in WebView.

There are often cases where Japanese websites include Japanese in the URL,

  • When you get the URL with shareExtent, you can receive the encoded one

  • When the user directly copies and pastes the browser URL, whether the copied URL is encoded or not depends on the browser specifications. In chrome and firefox it is encoded but in safari it is not

In such a case, it becomes a situation that you do not know whether the registered URL is encoded or not.



Solution

All you have to do is conv.

Uri _uri = await Uri.parse(url);
await launchUrl(_uri);


Recent Posts

See All

[C] Array of function pointers

What want to do As stated in the title, I would like to define an array of function pointers. Specifically, for example, the third...

Comments


category

Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page