user48956
user48956

Reputation: 15794

How to find the URL that served the flutter web application?

I'd my webapp to available at:

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

How can I find the URL from which my app was downloaded (http://example.com/ui/), so that can produce the URL http://example.com/api/ from it?

I'd prefer to not bake the example.com into the webapp because we deploy to a number of clusters with difference domain names during CI.

Upvotes: 2

Views: 1621

Answers (1)

Slava R
Slava R

Reputation: 82

import 'dart:html' as html;

...
debugPrint('host=${html.window.location.host + html.window.location.pathname}');
...

Upvotes: 5

Related Questions