有没有办法让 URL 用于在 "Flutter web" 应用程序的代码中启动应用程序?

Is there a way to get URL used to launch the app in the code for "Flutter web" app?

在使用 Dart 和 Flutter web 构建网络应用程序时,我们能否以某种方式获取用于在 Dart 代码中启动网络应用程序的 URL?我需要为用户将本地部署在他的一台机器上然后从浏览器启动的工具构建一个网络应用程序。我需要能够在 Web 应用程序中获取服务器的 IP address/host 名称,然后进行进一步的 gRPC/REST 调用。

如评论中所述,您可以使用类似以下未经测试的示例:

import 'dart:html' as html;

...
// Use whichever of the following you need:
final url = html.window.location.href;
final hostname = html.window.location.hostname; // you probably need this one