I have a basic flutter website that works fine in localhost when doing flutter run -d chrome
, but when I was ready to publish it, with the command flutter build web
, it shows a blank page and throw some generic errors by console.
Console errors on developer options
Checking other answers such as change the href on the index.html page aren’t working.
Running flutter doctor -v is showing this error, which I can’t find anything useful about, but the website cocoapods that is referencing is not available
[!] HTTP Host Availability X HTTP host "https://cocoapods.org/" is not reachable. Reason: Failed to connect to host in 10 seconds
2
Answers
Thank you for your answer Adedokun,
So, turns out I'm still learning, and the index.html page is never going to work alone, according to the documentation here, you need to go to the folder root and launch a server by console, in this case I did with
python -m http.server 8000
, and navigated in a browser to localhost:8000, then go to build, then web. Also, in the /build/web index.html, needed to change the href="/" to href="./" so it could work finally, it appears that href="" works too. I hope this helps someone too.and about the Availability, it was just temporal, this morning the flutter doctor didn't show any error :)
This has to deal with CORS error. one way of fixing this by using the HTML renderer.
or try the solutions here. Link