如何找到为 flutter Web 应用程序提供服务的 URL?

use*_*956 2 flutter flutter-web

我希望我的网络应用程序可以在以下位置使用:

  http://example.com/ui/      # My flutter web application
  http://example.com/api/...  # REST endpoints
Run Code Online (Sandbox Code Playgroud)

如何找到下载应用程序的 URL ( ),以便从中http://example.com/ui/生成 URL ?http://example.com/api/

我不想将其烘焙example.com到 Web 应用程序中,因为我们在 CI 期间部署到许多具有不同域名的集群。

小智 5

import 'dart:html' as html;

...
debugPrint('host=${html.window.location.host + html.window.location.pathname}');
...
Run Code Online (Sandbox Code Playgroud)