是否可以在 flutter web 中为域添加前缀?

is it possible in flutter web to add prefix to the domain?

我是 flutter web 开发的新手,我需要你们的帮助。我正在 flutter web 中构建一个应用程序,并且在该应用程序的域中我想添加前缀 例如:

(商店。)localhost.com 要么 (user123341.)localhost.com.

如果你们有任何关于此的小信息,请分享您的信息。非常感谢。

是的,当 Flutter 编译为 Javascript 和 HTML 时,完全可以将 Flutter Web 应用程序上传到子域。您可以将其上传到您想要的任何子域。但在你的情况下,你想使用 localhost.

您需要了解 localhost 不是纯粹的域,您不能向其添加子域。但是有一些解决方法可以做到这一点:

基于此answer,您可以尝试将子域添加到本地主机,如下图所示。

 C:\Windows\System32\drivers\etc\hosts

并在其后附加如下行:

127.0.0.1    example.com
127.0.0.1    subdomain.example.com