【问题标题】:How to find the URL that served the flutter web application?如何找到为 Flutter Web 应用程序提供服务的 URL?
【发布时间】:2020-03-11 20:46:51
【问题描述】:

我的 webapp 可以在以下位置使用:

  http://example.com/ui/      # My flutter web application
  http://example.com/api/...  # REST endpoints

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

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

【问题讨论】:

    标签: flutter flutter-web


    【解决方案1】:
    import 'dart:html' as html;
    
    ...
    debugPrint('host=${html.window.location.host + html.window.location.pathname}');
    ...
    

    【讨论】:

      猜你喜欢
      • 2020-08-18
      • 2017-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-15
      • 2021-10-25
      • 2020-04-23
      • 2020-04-12
      相关资源
      最近更新 更多