1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

flutterのurl_launcherライブラリのlaunchでLost Connectionになってしまう

Posted at

現象

Flutterのurl_launcherライブラリを使っていて、

final badUrl = 'https://sample.com/マルチバイト文字.pdf';
launch(badUrl);

↑のような形でlaunchをした際に無言でLost Connectionになってしまいました。

原因と解決法

マルチバイトが含まれているせいだったようです。

final badUrl = 'https://sample.com/マルチバイト文字.pdf';
// ↓の処理を追加
final goodUrl = Uri.encodeFull(badUrl);
launch(goodUrl);

↑これで治りました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?